Bubble sort
Lesson 5 of 20 · Algo.Micro
Compare neighbours and swap: big values bubble to the end.
Walk from left to right comparing each pair. If the left one is bigger, swap them. Watch the comparison and swap counters.
Check yourself
After the first pass of bubble sort, which value is guaranteed in place?
Do it in the browser: a real algorithms tool, a short mission and instant feedback. No install.
Start this lesson — free