04 Try it yourself Interactive

Watch the minimum move without the array moving

Press Next once per operation — nothing runs on its own. The amber bar is the value being compared right now, and the amber band marks what it is being compared against: in Min index that is the single remembered minimum slot, and in Swap as you go it stretches from slot i out to the bar, because that version keeps the running smallest inside slot i itself. Either way the min tag sits under the slot holding the smallest value found so far this pass. Rose is a write. Green is final.

Start on Swap as you go, then flip to Min index and watch the comparison counter stay identical while the swap counter drops — on the lesson list, 4 writes become 2.

Swap-as-you-go · a write per improvement
writes inside the loop
2–9 whole numbers (0–99), commas or spaces.
Press Next to begin. Each press moves one step.


      
Pass i
Scanning j
Comparisons0
Swaps0
step 0 / 0