Reverse doubly linked list
Swap each node’s next and previous links, then make the old tail the head.
Remember: Swap both links; swap the ends.
Example: 10 ⇄ 20 ⇄ 30 becomes 30 ⇄ 20 ⇄ 10.
Time: O(n). Auxiliary space: O(1).
Formula: swap(current.next, current.prev)
Both next and prev links are rewired. The original tail becomes the new head.
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.