Linked listsExplained
Reorder List
Interleave the first half with the reversed second half.
Time
O(n)
Extra space
O(1)
Use it for
L0→Ln→L1→Ln−1… pattern.
Interleave the first half with the reversed second half.
Time
O(n)
Extra space
O(1)
Use it for
L0→Ln→L1→Ln−1… pattern.