CSC300 / CSC402: Nullable Recursion [5/5] |
Easiest to write, once you understand it. We don't know if a new node will be created in the helper! Therefore, it's important that the helper function return something back to its caller, and the caller always update the appropriate pointer. Even if a pointer ends up not being changed, the caller doesn't know if it needs to be changed, so it must unconditionally do the assigment of the pointer! Some common mistakes:
|