Sort Algorithm Reference
A reference list of every sorting algorithm in the Algorithm Guide, grouped from the essentials to the joke sorts, with a short note on why each one matters.
Every sorting algorithm covered by the Algorithm Guide, grouped into five tiers, from the essentials every developer should know to the ones that exist only as jokes. Algorithms with a guide link to it; the rest are on the way.
Tier 1: The Essentials
The sorts taught in every computer science course and asked about in every interview.
| Algorithm | Why it matters | Guide |
|---|---|---|
| QuickSort | The standard divide-and-conquer sort, and the basis of most library sorts. | QuickSort in Java |
| Merge Sort | A stable O(n log n) sort that shows recursion and divide-and-conquer clearly. Variants: recursive, no extra space, concurrent. | Merge Sort in Java |
| Heap Sort | An in-place O(n log n) sort that also teaches the heap data structure. | Heap Sort in Java |
| Insertion Sort | The best choice for small or nearly sorted inputs, and used inside hybrid sorts. | Insertion Sort in Java |
| Bubble Sort | The classic first sorting algorithm. Variant: recursive. | Bubble Sort in Java |
| Selection Sort | The other basic O(n²) sort. Variant: recursive. | Selection Sort in Java |
Tier 2: Important in Practice or Theory
The sorts behind standard libraries, the linear-time sorts that avoid comparisons, and one graph algorithm that every build system relies on.
| Algorithm | Why it matters | Guide |
|---|---|---|
| TimSort | The sort behind Java’s Arrays.sort(Object[]) and Python’s built-in sort. | Coming soon |
| Dual-Pivot QuickSort | The sort behind Java’s Arrays.sort() for primitive types. | Coming soon |
| Introsort | Introspective sort, the algorithm behind C++ std::sort. | Coming soon |
| Counting Sort | The main non-comparison sort, with linear time. | Coming soon |
| Radix Sort | Digit-by-digit sorting built on counting sort. | Coming soon |
| Bucket Sort | Distribution sorting for uniformly spread data. | Coming soon |
| Shell Sort | A historically important improvement on insertion sort, using gap sequences. | Coming soon |
| Topological Sort | A graph algorithm rather than an array sort, but essential for dependency resolution and build systems. | Coming soon |
Tier 3: Well Known, More Specialised
Variations on the basic sorts, sorts built on other data structures, and sorts designed for parallel hardware.
| Algorithm | Why it matters | Guide |
|---|---|---|
| Dutch National Flag Sort | Dijkstra’s 3-way partition, and a common interview problem. | Coming soon |
| Tree Sort | Sorting by inserting into a binary search tree. | Coming soon |
| Priority Queue Sort | Heap sort written with Java’s PriorityQueue. | Coming soon |
| Binary Insertion Sort | Insertion sort that uses binary search to find each position. | Coming soon |
| Cocktail Shaker Sort | Bubble sort that passes in both directions. | Coming soon |
| Comb Sort | Bubble sort with shrinking gaps. | Coming soon |
| Cycle Sort | Makes the minimum possible number of writes. | Coming soon |
| Pigeonhole Sort | Similar to counting sort, for small key ranges. | Coming soon |
| Bitonic Sort | A parallel sorting network used on GPUs and in hardware. | Coming soon |
| Odd-Even Sort | Brick sort, a parallel-friendly sort. | Coming soon |
| Pancake Sort | A famous puzzle, and the subject of Bill Gates’ only research paper. | Coming soon |
| Patience Sort | Important for its link to the longest increasing subsequence problem. | Coming soon |
| Smooth Sort | Dijkstra’s adaptive variant of heap sort. | Coming soon |
| Gnome Sort | A simple teaching variant of insertion sort. | Coming soon |
| Tournament Sort | Sorting with a winner tree, used in external sorting. | Coming soon |
| Wiggle Sort / Wave Sort | Interview problems that produce alternating high and low values rather than a true sorted order. | Coming soon |
Tier 4: Niche or Rarely Taught
Hybrids, curiosities and exercises that are worth knowing about but rarely used.
| Algorithm | Why it matters | Guide |
|---|---|---|
| Spread Sort | A hybrid radix sort used in Boost.Sort. | Coming soon |
| Flash Sort | Distribution sorting by classifying elements into buckets. | Coming soon |
| Library Sort | Gapped insertion sort. | Coming soon |
| Strand Sort | Pulls out sorted sublists and merges them. | Coming soon |
| Adaptive Merge Sort | Merge sort that adapts to existing runs in the data. | Coming soon |
| Exchange Sort | A simple compare-and-swap sort, often confused with bubble sort. | Coming soon |
| Circle Sort | Recursively swaps elements in a circle pattern. | Coming soon |
| Bead Sort | Gravity sort, interesting as a physical model. | Coming soon |
| Linked List Sort | Applies sorting techniques to a linked list; more an exercise than a separate algorithm. | Coming soon |
| Swap Sort | Places each element by counting smaller values, and only works on unique values. | Coming soon |
| Dark Sort | The version in TheAlgorithms/Java is essentially counting sort under another name. | Coming soon |
Tier 5: Jokes and What Not to Do
Sorts that exist to make a point, usually about how not to sort.
| Algorithm | Why it matters | Guide |
|---|---|---|
| Bogosort | Shuffles until the array is sorted. The best-known joke sort. | Coming soon |
| Stooge Sort | A famously inefficient recursive sort. | Coming soon |
| Slowsort | Built on purpose to be as slow as possible (“multiply and surrender”). | Coming soon |
| Stalin Sort | A meme sort that deletes every element that is out of order. | Coming soon |
