DSA · Reimagined
Linked Lists medium time O(n) space O(1)

Reverse a Linked List

Take nodes off the front of the original list one at a time and put each on the front of a new list. Because each node goes to the front, the order comes out reversed — and no extra nodes are ever created.

reversed so far
still to do
7
0
3
1
9
2
4
3
cur

Reverse by moving each node from the front of the list to the front of a new one.

1 / 10

Practice

Machine twin: /dsa-viz-v2/linked-list-reverse.json — the full deterministic run as structured data.