Sorting Visualiser

Step through bubble, selection, insertion, merge, quick or heap sort one comparison at a time, or let it play at your own speed. The highlighted line of code and the moving bars are read from the same trace, so they never fall out of sync.

A frontend app built by Ananda Rizki. More of them at Labs.

Sortviz

8 values, in the order they were given. Each pass walks left to right.

Comparisons
0
Swaps
0
34
12
78
5
61
23
90
41
0
1
2
3
4
5
6
7
  • Comparing
  • Swapping
  • Settled
  • Untouched
03const n = a.length;
Labs — by Ananda Rizki

Simulator

Sorting Visualiser

Sorting algorithms stepped one comparison at a time, with the array, the code pointer, the counters and the sound all rendering the same frame index — the run is traced before anything is drawn, so the pointer cannot drift from the animation and stepping backwards costs exactly what stepping forwards costs. The sound is a Web Audio instrument in about eighty lines, no dependency and no audio files: pitch is the value, mapped exponentially from F3 across 2.2 octaves, so an out-of-order pair falls and a settled one rises.

Built by Ananda Rizki, a frontend developer — one of the small web apps he writes for fun at Labs.