Sorting puts n values in order, and it is the most studied problem in computing because almost everything depends on it: searching, grouping, deduplicating, drawing.
The 12 algorithms here go from bubble sort, which everyone learns first, to quick sort and heap sort, which standard libraries build on. Each one spends comparisons and swaps differently; the bars make that visible.
All algorithms
14Each card runs its own algorithmAdjacent swaps push the largest value to the end each pass.
Takes each value and slides it left into the sorted prefix.
Finds the minimum of the rest and swaps it to the front.
Bubble sort in both directions, so small values also move fast.
One pointer walks forward and steps back on every inversion.
Bubble sort with a shrinking gap, which kills turtles early.
Insertion sort over gapped subsequences, then a final gap of 1.
Merges sorted runs of doubling width. Stable, needs a buffer.
Partitions around a pivot, then recurses on both sides.
Builds a max-heap, then pops the maximum to the end n times.
Alternates odd and even pairs; every pair in a phase is independent.
Buckets by digit, least significant first. No comparisons at all.
One timer per value; whoever wakes first is printed first. The scheduler does the sorting.
Shuffle until it happens to be sorted. The joke every sorting video ends with.