AlgoScope

Remove Cycle

AlgorithmintermediateLinked List Operations

After slow and fast meet, walk from the head and the meeting point to the entry, then once round the loop to cut the arrow before it.

Decision · step 2 of 10List Pointer Puzzles: Cut a loop back to the third node
123456headslowfast

Slow to 2, fast to 3. Not the same node yet.

Open in the player →or start at step 2

What you will see

The arrow that closes the loop is cut.

How list pointer puzzles 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.

Before this

Taught by the same lesson

List Pointer Puzzles covers these too, in the same run.