Mark As Completed Discussion

There are many ways to do the actual reversal, and we'll cover both an iterative and recursive approach, but the general methodology is as follows:

  1. Begin by creating 3 pointers: newHead, head and nextNode.
    1. newHead and nextNode are initialized to null.
    2. head starts off pointing to the head of the linked list.
  2. Iterate (or recursively do) through the following process until head is null. This means that the end of the list has been reached:
JAVASCRIPT
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment