Sort Algorithm Reference

Every sorting algorithm in the Algorithm Guide, from the essentials to the joke sorts.

Sort Algorithm Reference

A reference list of 45 sorting algorithms, grouped into five tiers from the sorts every developer should know to the ones that exist only to make a point. Each one comes with a short note on why it matters and a link to its Java guide.

There are dozens of sorting algorithms, and they are not all equally worth your time. This reference sorts the sorts: it groups every algorithm covered by the Algorithm Guide into five tiers, from the ones taught in every computer science course to the ones that exist only as jokes.

How to Use This Reference

Each tier on the reference page lists its algorithms with a short note on why each one matters. Algorithms that already have a guide link straight to it, with the theory, a step-by-step walkthrough and a Java implementation. The rest are marked as coming soon, and the list grows as new guides are published.

  • New to sorting? Start with Tier 1 and work through the six essential sorts in order.
  • Preparing for interviews? Tier 1 and the partitioning problems in Tier 3 cover what you’re most likely to be asked.
  • Curious how real libraries sort? Tier 2 explains the algorithms behind Arrays.sort(), Python’s sorted() and C++’s std::sort.

The Five Tiers

TierTitleWhat it coversAlgorithms
1The EssentialsThe sorts taught in every course and asked about in interviews6
2Important in Practice or TheoryLibrary sorts, linear-time non-comparison sorts and topological sort8
3Well Known, More SpecialisedVariations on the basic sorts, sorts built on other data structures and sorts for parallel hardware16
4Niche or Rarely TaughtHybrids, curiosities and exercises11
5Jokes and What Not to DoSorts that exist to show how not to sort4

Start with the Essentials

All six Tier 1 sorts already have a full guide:

AlgorithmWhy it mattersGuide
QuickSortThe standard divide-and-conquer sort and the basis of most library sortsQuickSort in Java
Merge SortA stable O(n log n) sort and a great way to learn recursionMerge Sort in Java
Heap SortAn in-place O(n log n) sort that also teaches you how heaps workHeap Sort in Java
Insertion SortThe best choice for small or nearly sorted input, and a building block of hybrid sortsInsertion Sort in Java
Bubble SortThe classic first sorting algorithmBubble Sort in Java
Selection SortThe other basic O(n²) sort, and a useful contrast to bubble sortSelection Sort in Java

Once you know these, the Problem-Solving Patterns Reference shows the patterns behind them, such as recursion and divide and conquer, and where else those patterns are used.

Open the Sort Algorithm Reference →