AlgoScope

Dutch National Flag

AlgorithmintermediateArray Techniques

Three pointers sort the array into less, equal and greater in one pass.

Decision · step 2 of 10Rotate, Partition, Select: Sort into less, equal, greater
active 0-61001221314052627lowmidhigh2 > 1

2 is larger than 1, so it swaps up to index 7. High moves down, but mid stays: the value that came back is still unknown.

Open in the player →or start at step 2

What you will see

Three regions grow from the ends and the middle; the scanning pointer routes each value.

How rotate, partition, select 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.

Screen readers: Each cell is announced as index, value and state; each step's accessibility text states the decision and its effect.

Reduced motion: Swaps and shifts become value crossfades with an outline flash; pointers appear at their destination.

Before this

Leads to

Topics that need this one first.

Taught by the same lesson

Rotate, Partition, Select covers these too, in the same run.