ASAPUtils Logo ASAPUtils
Week 5

Reorder List

Reorder List derived as middle finding, second-half reversal, and alternating weaving, with pointer-safe C++ and JavaScript implementations, correctness, complexity, cycle traps, and an interactive composition trace.

The problem

Reorder one linked list in place from L0,L1,...,Ln into L0,Ln,L1,Ln-1,... without changing node values.

1 -> 2 -> 3 -> 4 -> 5 becomes 1 -> 5 -> 2 -> 4 -> 3

Related Problems