dsa1 min read
Swap Nodes in Pairs — In-Place Pointer Rewiring
Swap every two adjacent nodes in a linked list without modifying node values using pointer rewiring.
Read →
webcoderspeed.com
1276 articles
Swap every two adjacent nodes in a linked list without modifying node values using pointer rewiring.
Group all odd-indexed nodes before even-indexed nodes in O(n) time and O(1) space using two pointer chains.
Rotate a linked list to the right by k places by finding length, computing effective rotation, and rewiring.
Reorder a linked list into L0→Ln→L1→Ln-1 pattern by splitting at middle, reversing second half, then merging.
Add two numbers represented as reversed linked lists by simulating digit addition with carry propagation.