AlgoScope

Reorder List

AlgorithmintermediateLinked List Operations

Middle by slow and fast, reverse the second half, weave first and second alternately.

Decision · step 2 of 10Rewiring a List: Reorder first, last, second, ...
12345!6!7!headslowfast

Slow moves one node for every two of fast. Fast stops at 7, so slow is at 4: the first half is 1, 2, 3, 4, the second 5, 6, 7.

Open in the player →or start at step 2

What you will see

Two halves zip together one node at a time.

How rewiring a list works →

Cost

BestO(n)
AverageO(n)
WorstO(n)
SpaceO(1)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next, try operations in any order.

Screen readers: Each node announces its value and what it points to; each step announces the pointer change ("node 3 now points to node 5").

Reduced motion: Pointer arrows redraw in place with a brief emphasis instead of animating the detach and reattach.

Taught by the same lesson

Rewiring a List covers these too, in the same run.