Module 3 · Linked List · Linked List Questions

Reverse linked list

Walk three pointers down the list: secondNode gets turned to point back at firstNode, and thirdNode holds on to the rest before that link is lost. At the end the old head points to null and firstNode is the new head.

On the linked list nodes stay put while their links turn, then slide into the new order.