Reverse singly linked list
Reverse every next link so the original tail becomes the new head.
Remember: Save next → reverse link → advance.
Example: 10 → 20 → 30 becomes 30 → 20 → 10.
Time: O(n). Auxiliary space: O(1).
Formula: next = current.next; current.next = previous
Each node keeps its identity even when its pointer changes. The input can contain repeated values.
Complexities describe the underlying algorithm; tutorial snapshots and rendering can use additional resources.
The interactive workspace loads here when JavaScript is available. You can still browse the learning notes and links above without it.