04 Try it yourself Interactive

One click = one step

Pick a version and a list — or type your own — then press Next. The code line lights up together with the bars, and the caption explains each move in plain words. Arrow keys work too.

Naive version
scans the whole row
2–9 whole numbers (0–99), commas or spaces.
Press Next to begin. Each press moves one step.


      
sweep i
index j
compares0
swaps0
step 0 / 0