Sound of Sorting

Nine algorithms, made audible. Each has its own song.
The Night Gazette
Vol. I — Toybox No. 12
2026-05-09 · V
Bubble Sort O(n²) Swap adjacent pairs, sweep after sweep. Sound: slow ascending wash.
Comparisons: 0
Writes: 0
Elapsed: 0.00s
Status: idle

Bubble Sort — O(n²)

Swap adjacent out-of-order pairs, sweep after sweep. The sound is a slow ascending wash; the largest values bubble to the top one pass at a time, and you hear that ascent as a rising drone.

Insertion Sort — O(n²)

Slide each new element back into its place in the sorted prefix. Like sorting a hand of cards. The song is gentle and patient, with small ratchets backwards.

Selection Sort — O(n²)

Scan, find the minimum, swap it to the front. The most architectural of the slow sorts — long quiet sweeps punctuated by single decisive thuds.

Cocktail Shaker — O(n²)

Bubble sort running both directions on alternate passes. The sound rocks back and forth, shrinking inward from both ends — a pendulum gradually settling to stillness.

Quicksort — O(n log n) avg

Pick a pivot, partition around it, recurse. The most chaotic song: bursts of partitioning at different scales overlap into something like sparse jazz.

Merge Sort — O(n log n)

Divide, recursively sort, merge back. The merges are the music — long, even cascades. The most orchestral of the nine.

Radix Sort — O(nk)

Sort by individual digits (LSD). Each pass is a sweeping wave, bucketing by the current digit. The sound is regular, cyclical, almost mechanical — sorting without comparison.

Pancake Sort — O(n²)

Reverse prefixes to flip the maximum into place, then flip it to its final position. Theatrical: you hear the whole stack fold and unfold with each theatrical reversal.

Stooge Sort — O(n^2.71)

Dijkstra's comedically slow algorithm: sort the first two-thirds, then the last two-thirds, then the first two-thirds again. Recursive, lumbering, and oddly meditative.