Learn Sorting Algorithms Visually
Understand bubble, insertion, merge, quick, and heap sort by watching bars slide, compare, and settle — with counters that make O(n²) vs O(n log n) concrete.
Problem
Sorting algorithms in a textbook are ten lines of pseudocode that all blur together — you can recite them without understanding what actually moves.
What to do
Watching the data move is what separates memorizing from understanding. Run the same nearly-sorted array through insertion sort and selection sort and the comparison counters tell the whole story: one adapts, the other doesn't. The sliding swap animation shows WHY bubble sort's big values 'bubble' and why quicksort's partition zones work.
- 1Open the Sorting Visualizer and pick an algorithm tab.
- 2Choose a preset that exposes behavior — Nearly sorted for insertion sort's best case, Reversed for bubble sort's worst.
- 3Play at slow speed and watch the TRUE/FALSE verdict on every comparison, then check the counters.
- 4Run a second algorithm on the same data and compare comparisons and writes — that difference IS the complexity class.
Use the browser tool
Sorting Algorithm Visualizer animates bubble, selection, insertion, merge, quick, and heap sort on bars that physically slide past each other when they swap. Every comparison shows a colored TRUE/FALSE verdict, the pseudocode highlights the running line, and live counters track comparisons and writes — so the O(n²) vs O(n log n) difference stops being abstract.
People also ask
- Why do the bars slide instead of jumping?
- Each bar keeps a stable identity, and its position animates when a swap moves it — the slide IS the swap, which makes the algorithm's data movement visible.
- What do the colors mean?
- Amber bars are being compared, red bars are being moved or written, violet marks the pivot or key, and green bars are locked in their final sorted position.
- Can I sort my own numbers?
- Yes — open "Use my own numbers" and paste up to 120 values separated by commas or spaces.

