Skip to content
BytePatterns

Sorting

See why the clever sorts beat the obvious ones.

Sorting progress0 / 8
  1. Sorting BasicsComparisons, swaps, stability: the vocabulary of order.4m
  2. Bubble SortSwap neighbours until the big values float to the end.4m
  3. Selection SortFind the smallest, put it in front, then do it again.4m
  4. Insertion SortBuild a sorted run, slide each newcomer into place.5m
  5. Merge SortSplit until trivial, then merge your way back up.6m
  6. Quick SortPick a pivot, split around it, and never merge.6m
  7. Counting SortSkip comparisons entirely when the values are small.5m
  8. Which Sort When?The right sort is the one that fits your data's shape.5m