Six numbers. One question.
Can a procedure that first puts the largest number at the front still finish with the smallest first? Keep your prediction in mind. Scroll to watch what happens.
A GUIDED VISUAL STORY · SORTING
A scientist tried to write a bad sorting algorithm. It worked.
AI found better tiny routines. How was there still room to improve?
Follow the numbers. Leave with a way to think.
↓ Just scroll. The illustrations follow the story.
Prefer experimenting? Open the hands-on playground · Research through 13 September 2026
01 / A STRANGE MACHINE
Can a procedure that first puts the largest number at the front still finish with the smallest first? Keep your prediction in mind. Scroll to watch what happens.
The first round moves 6 to the front. That looks backwards. But one intermediate picture cannot tell you where a procedure will finish.
After the third round, the first three positions are ordered, with 6 at their right edge. That growing ordered section is the useful clue.
Each new value is inserted into the ordered section, and its maximum travels to the new boundary. At the last boundary, the whole list is ordered.
Stanley Fung described this surprising all-pairs algorithm in 2021. For each position, it visits every position and swaps when the first value is smaller. The preserved promise explains its result; a few successful examples alone would not. Read the source ↗
02 / SAME PICTURE, DIFFERENT WORK
These eight strips belong to one illustration. Each carries a number specifying its correct position. The computer reads those numbers; it does not recognise mountains.
Insertion sort takes the next strip and moves it left past larger neighbours. Notice how the smaller strips have gathered on the left.
Merge sort builds ordered groups and combines them, taking the smaller front record next. It uses temporary storage. Here we show checkpoints where every strip is back in the main row.
Both preserve all eight strips and reconstruct the picture. The counters show key comparisons and main-array writes for these teaching implementations. Scroll distance and animation duration are not measures of execution time.
03 / BETTER FOR WHAT?
Compare insertion sort with selection sort, which repeatedly finds the smallest remaining item. For this small shuffled input, inspect the actual work before declaring a winner.
Only two neighbours are out of place. Insertion can reuse the existing order. Selection still scans the unfinished section to find its minimum. The same input size does not imply the same work.
These strips have unique destination numbers from 1 to 8. With eight output slots, place each directly in its numbered slot: eight placements, plus output storage. A small, known key range changes the problem. For general records with duplicate integer keys, counting sort needs counts and assigned output positions.
04 / WHAT MUST SURVIVE?
An expense is more than its amount. “Groceries, ₹840” is one record. The amount is the sorting key. Its label must travel with it.
The numbers now increase, but groceries suddenly cost ₹180 and the notebook ₹840. This is an ordered column and a broken set of records. Correct sorting must preserve their associations.
Now notebook, train and groceries remain attached to their original amounts. In Excel or Google Sheets, the practical lesson is to include the complete record range. We do not claim either product uses a particular internal sorting algorithm. Explore ties and everyday examples ↗
05 / WHERE AI ENTERS
Here is a toy program: compare positions 1 and 2, then 2 and 3, exchanging values when they are reversed. It sorts some inputs. Testing all six orders of three distinct values reveals the failures.
Compare positions 1 and 2 again. All six inputs now pass. This is a classic three-comparison network, not an AI discovery. It illustrates the distinction between proposing a candidate and checking it.
In 2023, AlphaDev searched for faster small sorting routines at the assembly-instruction level; some were integrated into LLVM’s libc++ sorting implementation. It did not replace the whole field with one universal new sort. The lesson is that an old task can still hide opportunities when you change the representation and the operations available. Read the sourced AI account ↗
TAKE THE HABIT WITH YOU
Define the goal.
What does “ordered” mean here?
Protect the records.
What must stay attached or unchanged?
Use what you know.
Is there existing order or a limited key range?
Name the trade-off.
Time, storage, predictability—or something else?
Sorting is a useful first lesson in structured thinking because you can see the steps and check the result. It is not the whole of critical thinking: choosing a fair ranking or deciding whose needs matter requires judgment beyond arranging keys.
You have reached the end of the guided story. Try the experiments below, or explore the historical atlas.
A scientist tried to write a bad sorting algorithm. It worked.
AI found better tiny sorting routines. How was there still room to improve?
Start with a guess. Leave with a way to think.
This machine repeatedly compares pairs. Its first whole round puts the largest number at the front. That seems like an odd start for putting the smallest first.
Your prediction:
Make a guess to unlock the machine.
Here is the rule: visit each position from left to right. For each one, compare its current value with every position from left to right. If its value is smaller than the value it meets, exchange the two records.
After every round, the section up to the marked boundary is in order, and a largest number sits at its right edge. At the final boundary, that section is the whole list.
Start with an ordered section ending in a maximum. The next value walks through this section. When it is smaller than the value it meets, the two exchange places: the smaller stays behind and the larger continues. This inserts the new value into the section and carries the maximum to the new boundary. Later comparisons cannot dislodge that maximum because nothing is larger.
The first round establishes the maximum at position one. Each later round extends the ordered section by one. A fixed number of rounds makes the procedure stop. That is the beginning, the preserved promise, and the finish of the argument.
This is Stanley Fung’s surprising all-pairs algorithm, described in 2021. Its discovery is a human story. The AI story comes later. Read the formal verification ↗
WHAT DID YOU JUST DO?
Sorting means putting records in a chosen order while keeping every original record. The property we compare is the key.
A price, a date, a score, or the position number on a picture strip. The whole record travels with its key.
An algorithm is a precise procedure made of steps someone else can follow. Sorting the cards yourself is a start. Explaining which pair to inspect next turns your intuition into a procedure.
Trying ten inputs does not prove all inputs work. A promise that holds at the start, survives every step and implies the goal at the end is called an invariant.
01 / BE THE ALGORITHM
Your cards are in order. You pick up a 5. Help it find its place using only its left-hand neighbour.
Choose a move. A wrong guess is useful information.
You just used insertion sort’s idea: reuse the order you already have. The processed section stays ordered after each insertion. This adjacent-swap version trades places; another version holds the new card and shifts its neighbours. Source ↗
02 / ONE PICTURE. SIXTEEN PROCEDURES.
Every method gets exactly the same shuffled strips. Their numbers tell it where each strip belongs. The computer is reading numbers, not recognising the scene.
A visual step is a checkpoint, not a unit of time. Buffered methods appear when all strips are back in the main row; intermediate buffer copies are omitted here. Use “Inspect trace” to examine those copies. Workspace labels describe the sorting procedure, excluding the storage used to animate it.
Before you run: which method do you think will do less work?
A comparison tests two keys. Moving a record into one main-array slot counts as one write; a swap counts as two. These counters exclude scratch-buffer writes, digit inspection and bookkeeping. Counting and radix sort can therefore show zero comparisons while still doing work. Playback duration is not execution time.
The picture has eight unique keys. It cannot demonstrate what happens to equal keys. Try the receipt example below for that. The existing lab offers full traces and real device timings for three teaching implementations.
Yes. With unique position numbers 1–8, allocate eight output slots and put each strip directly in its numbered slot. That takes one placement per strip plus the output storage. You used extra knowledge about the keys, not a cleverer comparison.
A thought to keep: understand the information available before choosing a famous method.
03 / THERE IS NO SINGLE WINNER
Choose a situation, then make a case for a method. “Better” needs a resource and a constraint.
Choose a method to see the reasoning.
WHAT EXTRA INFORMATION BUYS YOU
For two-digit numbers, first order the units digit. Then order the tens digit, keeping ties in their previous order. This is least-significant-digit radix sorting. Source ↗
21, 13, 12, 22. Predict the result of sorting only by the last digit.
The useful promise changes with the method. In insertion sort, a growing section stays ordered. Here, the digits already processed stay correctly ordered within each new group.
COUNT THE WORK BEFORE YOU TIME IT
n means the number of records. Comparing every position with every position makes n × n comparisons. Doubling n makes that expression four times larger. A halving strategy has log₂ n levels at powers of two; doing a linear pass per level produces the n log₂ n growth term.
These are illustrative growth functions in abstract work units, not measured runtimes or exact counts for merge sort. O describes an upper bound; Θ describes a tight growth rate. Constants, input structure and the operations counted still matter. Read the analysis ↗
“Average time” needs a population of inputs and an implementation. An almost ordered workload can favour a different method from a shuffled one. The detailed lab below measures actual device times and shows its assumptions.
A TRAP YOU CAN MEET IN A SPREADSHEET
These are the original expenses: groceries ₹840, train ₹320, notebook ₹180. Only the amount column was sorted. Tap the row whose amount is still correct.
Look at the associations, not just the increasing numbers.
Train and lunch both cost ₹320. Their names make them different records.
A stable sort preserves the original order of tied keys. Both arrangements can be sorted by amount; only one preserves this input’s tie order.
In Excel or Sheets, keep the intended records together and choose your sort columns deliberately. A second key can order records tied on the first. Product documentation describes these features, but does not establish which internal sorting algorithm runs. Excel ↗ Sheets ↗
Newest first uses time as a key. “Top” involves deciding relevance and what is shown. Choosing those criteria is a different problem from computing an order. More likes alone does not establish YouTube’s ranking formula. YouTube’s explanation ↗
04 / THE SECOND SURPRISE
Knowing a correct procedure does not tell us whether we can do the same job with fewer costly instructions.
In 2023, AlphaDev searched for small sorting programs at the level of machine instructions. It learned to build candidates that were correct and efficient. Small routines entered LLVM’s C++ standard library. Nature paper ↗
The discovery happened before deployment. A program can use the resulting routine without asking an AI model to sort each list.
This was an improvement to tiny building blocks. It did not invent sorting or remove the general limit on comparison-based sorting.
For three positions, choose a pair to add an instruction: compare the two and put the smaller on the left. Build a fixed sequence that sorts all six orders of 1, 2, 3.
Build a candidate, then test it. You can use up to six instructions.
Try neighbouring positions in this order: 1 ↔ 2, then 2 ↔ 3, then 1 ↔ 2. The middle comparison places the largest value last; the final one repairs the first pair. This is a classic sorting network, not an AI-discovered routine.
A DIFFERENT RULE MAKES A DIFFERENT PUZZLE
Make the smallest pancake sit on top and the largest on the bottom. Tap a pancake to flip everything from the top through that pancake.
Five pancakes. One legal kind of move.
Find the largest unfinished pancake. Bring it to the top with one flip, then flip the unfinished stack to put it at the bottom. Leave that finished bottom alone and repeat.
Bill Gates and Christos Papadimitriou studied bounds for prefix-reversal sorting in 1979; they did not invent the original puzzle. Source ↗
THE PART TO REMEMBER
Choose the key and direction. A list can be correctly ordered by the wrong criterion.
Every original record, including duplicates and its associated information.
Name what remains true, and why the unfinished part gets smaller.
Comparisons, moves, storage, or time? Choose the method for the actual constraints.
A clinic asks you to “sort appointments better”. What should you establish first?
Apply the thinking to a new situation.
Sorting is a clear place to practise precise thinking because the goal can be stated and checked. Choosing a fair priority rule, dealing with uncertainty, or finding a route through a network requires further ideas. Sorting teaches useful habits; it is not the whole subject.
You came to see whether it sorts.
Now you know what else to ask.
From arranging a hand of cards to an AI discovering code. The surprisingly human story of sorting, and what it teaches us about solving problems.
You already sort. You might just not call it an algorithm.
You put the soonest deadline first. You arrange receipts by date. You place a new playing card between two cards already in order. Each time, you choose what matters, then use a procedure to organise the things in front of you.
Our argument: sorting is a small laboratory for structured thinking. The answer is easy to recognise, so the interesting questions become visible: What must stay true? Why does this step help? Will it finish? What does it cost?
But “the best introduction to every algorithm” goes too far. Sorting begins with a known objective and an exact answer. Later, we will ask what changes when a product tries to decide what you should care about.
BEFORE THE COMPUTER SCIENCE
Start with a familiar task. Change its rule. Notice what moves, what stays together, and what information the rule needs.
CHAPTER 01 / DEFINE SUCCESS
A key is the property you order by: price, date, name or size. These numbers use smallest first; “best” would need a definition. ↗
Deleting the inconvenient numbers makes this list look ordered. But a true sort must keep every original item, including repeats. ↗
A computer can compare two keys, then exchange their records. A method must say which pair to inspect next, without relying on a person seeing the whole answer. ↗
In insertion sort, the processed prefix remains ordered after each insertion. This promise is an invariant: a fact that connects one step to the next. ↗
The processed prefix gains an item each round, and the input is finite. A rule plus an invariant plus progress gives a reason to trust the result; now ask what that progress costs. ↗
CHAPTER 02 / COUNT THE WORK
An ordered input needs only a short confirmation in insertion sort. Adaptive algorithms can benefit from structure that is already present. ↗
If every new item belongs at the front, an adjacent-swap insertion sort moves it past everything before it. This example needs 1 + 2 + … + 7 = 28 swaps. ↗
Merge sort splits the sequence until the pieces are trivial to sort. The teaching example has eight items, so halving reaches singletons in three levels. ↗
Merge two ordered runs by comparing their front values and taking the smaller. Each level processes the items again, giving growth proportional to n log n. ↗
O(n²) and O(n log n) describe how work scales, not seconds. Input, constants and hardware still matter; some methods even change which operations they need. ↗
CHAPTER 03 / EXPOSE THE ASSUMPTIONS
Four distinct items have 24 possible orders. A yes/no comparison decision tree needs at least five levels somewhere to distinguish them: four binary answers distinguish at most 16 possibilities. ↗
With small integer keys, counting sort can directly count occurrences. Its O(n + k) work includes the key range k; this is extra information the comparison-only model does not use. ↗
LSD radix sort can order the units digit, then the tens digit. Each pass must preserve the order of equal digits so the previous pass keeps doing useful work. ↗
A sorting network fixes the comparison schedule; independent pairs can run together. Memory use, parallel depth and total work are different costs, which is why history never converged on one winner. ↗
CHAPTER 04 / DOUBT, TEST, PROVE
In 2021, Stanley Fung described this all-pairs routine after trying to make incorrect sorts. The < sign looks backwards, yet the result is ascending. ↗
The first outer pass pulls a global maximum to the first position. Watch the whole pass before judging the direction of the result. ↗
After outer pass i, the prefix through i is ordered and its last item holds a maximum. At the last pass, that prefix is the entire array; an invariant explains the surprise. ↗
AlphaDev used reinforcement learning to discover small sorting routines published in 2023 and incorporated into LLVM libc++. It optimised low-level building blocks, not the asymptotic limit for arbitrary lists. ↗
In July 2026, researchers reported linear data moves alongside near-optimal comparisons in an in-place randomised method. The discovery changes a resource tradeoff; it does not make every existing sort obsolete. ↗
A PLAIN-LANGUAGE KEY TO THE SYMBOLS
If the list holds 1,000 receipts, n is 1,000. The receipt values are a different quantity.
Double the items and the growth term doubles. This is a bound on scaling, not a promise of exactly one operation per item.
At powers of two, log₂ n counts halvings. Doubling the input adds one level as well as doubling each level’s size.
Double n and n² becomes four times as large. Constants and small-input overhead still matter.
O is an upper-bound notation; Θ describes a tight growth rate. “Average” requires a distribution of inputs, “expected” may average over an algorithm’s random choices, and “worst” covers the hardest allowed input. None is a universal duration in seconds.
PAUSE & PREDICT
Input: 4, 2, 2, 7. Output: 2, 4, 7.
Choose an answer, then test it against the contract.
YOUR TURN / A LABORATORY, NOT A RACE VIDEO
Run real teaching implementations. Step backward, inspect the counters, and look for a reason the algorithm must work.
One comparison tests two keys. A swap writes two array slots. Buffer writes, digit inspections and loop tests are not counted as key comparisons. Zero comparisons in radix sort does not mean zero work.
Merge/counter methods temporarily keep records in a scratch buffer. The main-array view alone can show duplicates during copying; the final audit checks the complete result.
These are teaching versions, not copies of production library implementations. The implementation details shown in the selector matter.
“HOW LONG DOES IT TAKE?”
Compare insertion, merge and quicksort on the same generated values in your browser. Change input size or shape and measure again.
Mean of seven runs after two warm-ups. Mixed-order inputs draw values from 1–99, so large inputs contain duplicates. Timings include this implementation’s record creation and counters, exclude animation and display, and are not timings for Excel, Sheets or YouTube. Timer precision and browser load affect short runs.
Run the experiment.
Measure these implementations on your device.
A HISTORY OF CHANGING CONSTRAINTS
Dates below mark a documented milestone, not the birthday of every idea. Explore individual methods in the atlas.
Hollerith’s census equipment combines tabulation with a sorting table. Humans still place the cards into indicated drawers. ↗
Shellsort, published quicksort and heapsort offer different ways to organise work on electronic computers. ↗↗↗
Batcher networks and then the AKS construction explore how little sequential depth sorting needs. ↗↗
Introsort adds a fallback. Timsort exploits runs. Powersort improves the merge schedule. ↗↗↗
Learned distributions, AI-generated small routines, memory-aware hybrids and minimal-move research pursue different savings. ↗↗↗
THE SORTING ATLAS / RESEARCHED TO 13 SEP 2026
Foundations, variants, hybrids, special models and a few cautionary jokes. Open a row for the mechanism, story, costs, assumptions and sources.
This is a broad curated atlas, not an exhaustive inventory of every published or unnamed variant. There is no closed registry of all sorting techniques. The 74 entries include algorithm families, named variants, implementation designs and research results; they are not 74 independent inventions.
Dates identify publication, a documented appearance or adoption as labelled. “Classical” and “origin uncertain” mean no verified invention date is claimed. Original papers, author repositories, official documentation and institutional histories are prioritised. A preprint is labelled research, not independently verified performance.
Complexities refer to the stated implementation or model. n is the number of items, k the key range, d the number of digits, b the base and w the word width. “Stable” means preserving input order for equal keys. “In-place” conventions vary; see each memory note.
Grow an ordered prefix by inserting the next item and shifting larger items right.
WHY USE THIS IDEA?A small hand of cards, a short list, or the cleanup inside a larger sorting method.
THE STORY / CHARACTERISTICLike arranging a hand of cards. Its simplicity survives inside sophisticated library sorts.
The catch. Excellent for small or nearly ordered inputs; quadratic on reversed input.
Use binary search inside the ordered prefix, then shift to create the insertion slot.
WHY USE THIS IDEA?Small arrays whose keys are expensive to compare but whose records are cheap to shift.
THE STORY / CHARACTERISTICFewer comparisons need not mean fewer moves.
The catch. The array still has to make space; binary search does not make this an O(n log n) time array sort.
Scan the unsorted suffix for its minimum, then place it at the boundary.
WHY USE THIS IDEA?A teaching baseline when separating the cost of comparisons from the cost of swaps.
THE STORY / CHARACTERISTICYou can minimise swaps without minimising comparisons.
The catch. At most n−1 nontrivial swaps, but it rescans even already sorted input.
Swap adjacent inverted pairs; repeat passes until no swap occurs.
WHY USE THIS IDEA?Teaching local repair and early termination; rarely the first choice for large data.
THE STORY / CHARACTERISTICA large value can cross the array in one pass; a small value can crawl back slowly.
The catch. Useful for explaining local repair, usually a poor general-purpose implementation.
Alternate forward and backward bubble passes.
WHY USE THIS IDEA?A teaching comparison with bubble sort when small values need to travel left as well as large values right.
THE STORY / CHARACTERISTICAlso called bidirectional bubble sort. The return trip repairs the small-value crawling problem.
The catch. Symmetry improves some inputs without changing the quadratic worst case.
Compare values across shrinking gaps, ending with gap-one passes until no swaps occur.
WHY USE THIS IDEA?A study of whether moving distant inversions early reduces later adjacent swaps on the same input.
THE STORY / CHARACTERISTICDobosiewicz described a precursor; Box and Lacey published their account in Byte.
The catch. Unlike Shellsort, each gap gets a bubbling pass rather than a complete insertion sort.
Move forward if neighbours are ordered; otherwise swap and step backward.
WHY USE THIS IDEA?A compact way to express insertion-like repair using a cursor that walks forward and backward.
THE STORY / CHARACTERISTICSarbazi-Azad called its precursor Stupid Sort. Grune used the garden-gnome name.
The catch. An insertion-sort idea expressed as a walking cursor; naming history is not a single clean invention date.
Insertion-sort interleaved subsequences, shrinking the gap until it reaches one.
WHY USE THIS IDEA?An array sort with constant auxiliary storage, when the selected gap sequence suits the workload.
THE STORY / CHARACTERISTICNamed for Donald Shell, not a shell-shaped data structure.
The catch. Different gaps give different bounds. A single universal O(n log n) label would be misleading.
Sort two parts and repeatedly take the smaller front item to merge them.
WHY USE THIS IDEA?Combining already ordered runs, such as batches of dated records. External variants stream them from storage.
THE STORY / CHARACTERISTICEarly electronic-computing discussions by von Neumann already treated sorting as a fundamental workload.
The catch. Predictable growth; the usual array implementation buys easy merging with extra memory.
Merge runs of length one, then two, then four, continuing iteratively.
WHY USE THIS IDEA?A merge-based implementation that should use iterative passes rather than recursive calls.
THE STORY / CHARACTERISTICRecursion is a way to describe divide-and-conquer, not a requirement for implementing it.
The catch. The merge schedule is fixed and normally ignores existing long runs.
Recognise already ordered runs and merge them rather than starting from singletons.
WHY USE THIS IDEA?A collection already organised into ascending runs, where recognising those runs avoids rebuilding all order.
THE STORY / CHARACTERISTICReal data often brings some of its own order.
The catch. Run detection and the order of merges determine how effectively that structure is used.
Choose a pivot, partition around it, then sort the resulting regions.
WHY USE THIS IDEA?General-purpose in-memory sorting when fast partitions are useful; robust libraries add safeguards.
THE STORY / CHARACTERISTICHoare developed the idea while studying in Moscow and thinking about Russian-to-English translation.
The catch. Bad pivot splits can repeatedly leave almost the whole problem unsolved.
Partition into values smaller than, equal to, and larger than the pivot.
WHY USE THIS IDEA?A list containing many repeated keys, where equal values can be removed from further recursive sorting.
THE STORY / CHARACTERISTICEqual values become a finished middle region instead of being needlessly sorted again.
The catch. Especially instructive on many duplicates; pivot quality still matters.
Two pivots create three regions that are sorted recursively.
WHY USE THIS IDEA?An implementation study of partitioning into three regions and the memory scans those partitions require.
THE STORY / CHARACTERISTICYaroslavskiy’s variant entered Java’s primitive-array sorting implementation.
The catch. Two pivots are not automatically better: partition costs, memory scans and safeguards matter.
Build a max-heap, move its root to the end, then repair the smaller heap.
WHY USE THIS IDEA?A bounded worst case with little workspace, or a fallback when quicksort partitions go badly.
THE STORY / CHARACTERISTICA priority queue becomes a full sorting procedure when you repeatedly remove its winner.
The catch. Reliable worst case and little extra storage; heap navigation has different locality from sequential merging.
Use a forest of Leonardo heaps to retain useful order while selecting maxima.
WHY USE THIS IDEA?A memory-constrained setting where adaptation to existing order is worth more involved heap bookkeeping.
THE STORY / CHARACTERISTICDijkstra designed a heapsort relative that transitions smoothly toward linear work on ordered data.
The catch. The bookkeeping is considerably more intricate than ordinary heapsort.
Insert values into a search tree and read them in order.
WHY USE THIS IDEA?Records being inserted into an ordered search structure that will later be traversed in key order.
THE STORY / CHARACTERISTICIt shifts the sorting problem into maintaining an ordered data structure.
The catch. A plain unbalanced tree can degenerate into a chain. Duplicate storage must preserve all items.
Compare pairs up a tournament tree; emit the winner and replay its path.
WHY USE THIS IDEA?Repeatedly selecting the next record while retaining comparisons from earlier rounds in a tournament tree.
THE STORY / CHARACTERISTICOnly the matches affected by removing a winner need to be played again.
The catch. The extra tree records reusable comparison results instead of starting each minimum scan anew.
Find destinations and rotate items around permutation cycles.
WHY USE THIS IDEA?A situation where overwriting records is expensive and reducing writes is worth extra comparisons.
THE STORY / CHARACTERISTICHaddon studied cycles under conditions allowing linear sorting; the common teaching variant spends comparisons finding ranks.
The catch. Minimal writes and minimal comparisons are different goals. The original paper’s linear claim has assumptions.
Deal values onto ordered piles, then merge their top values.
WHY USE THIS IDEA?Reasoning about card piles and the length of an increasing subsequence, with a merge stage for full sorting.
THE STORY / CHARACTERISTICA card-game viewpoint connects sorting to the longest increasing subsequence.
The catch. Building piles alone does not emit a globally sorted list; extraction or merging still matters.
Pull an increasing strand out of the input, merge it into the output, and repeat.
WHY USE THIS IDEA?A linked-list exercise in removing increasing subsequences and merging them into an accumulated output.
THE STORY / CHARACTERISTICA linked list lets the procedure remove a strand without shifting an entire array.
The catch. Ordered inputs are friendly; many short strands can force repeated scanning and merging.
Pair elements, order the larger partners, then insert the smaller ones in a carefully chosen schedule.
WHY USE THIS IDEA?Small inputs whose comparisons are expensive enough to justify a carefully scheduled insertion process.
THE STORY / CHARACTERISTICA classic attempt to squeeze out comparisons, with special relevance to small input sizes.
The catch. Comparison counts are the objective; bookkeeping can outweigh savings in elapsed time.
Count occurrences, compute output positions and place each record into its slot.
WHY USE THIS IDEA?Dense integer categories such as a bounded score range, if the count array fits comfortably in memory.
THE STORY / CHARACTERISTICKnowing the key universe substitutes direct addressing for pairwise comparison.
The catch. A huge sparse range makes the count array expensive, even if there are few input items.
Sort by the least significant digit, then by each more significant digit using stable passes.
WHY USE THIS IDEA?Digit-structured identifiers. Punched-card processing provides a historical physical analogue.
THE STORY / CHARACTERISTICPhysical card sorting helps explain why digit-by-digit ordering predates electronic programs.
The catch. It relies on key representation and stability. Digit width and sign handling are part of the algorithm.
Group by the most significant digit and recursively refine each group.
WHY USE THIS IDEA?Strings or identifiers sharing prefixes, where later characters matter only inside tied groups.
THE STORY / CHARACTERISTICA shared prefix lets whole strings travel together before their next character matters.
The catch. Short strings need an end marker; empty and highly uneven buckets require care.
Distribute values into ordered ranges, sort within each range and concatenate.
WHY USE THIS IDEA?Numeric keys with a known useful distribution, so ordered ranges can divide the work into small local sorts.
THE STORY / CHARACTERISTICThe shape of the data can be useful information.
The catch. The usual linear expectation assumes balanced buckets and cheap internal work; one crowded bucket changes everything.
Count bucket sizes first so each bucket receives an exact output range.
WHY USE THIS IDEA?A distribution pipeline that must know each bucket’s size before assigning contiguous output space.
THE STORY / CHARACTERISTICSizing the destinations before moving records avoids guessing capacity.
The catch. Histogram construction is only one stage; items within a bucket may still need sorting.
Allocate a hole for each possible key and collect records in key order.
WHY USE THIS IDEA?Records whose integer keys occupy a small range and can be collected into one container per possible key.
THE STORY / CHARACTERISTICIt makes the range of possible values visible as a physical storage cost.
The catch. A counting-style technique; storing whole records in holes differs from storing only frequencies.
Count digit buckets and use cyclic moves to permute items into contiguous bucket regions.
WHY USE THIS IDEA?Digit-based grouping where a full second record array is undesirable and stability is not required.
THE STORY / CHARACTERISTICAn in-place relative of radix sorting, named by analogy with multi-colour partitioning.
The catch. Saving a full output array makes the permutation logic harder; stability is normally lost.
Estimate value classes, permute into classes, then clean up the local order.
WHY USE THIS IDEA?Numeric data where interpolation yields useful classes and the subsequent cleanup stays inexpensive.
THE STORY / CHARACTERISTICNeubert published the method at euroFORTH and in Dr. Dobb’s Journal.
The catch. Interpolation needs useful value ranges; skew and the cleanup method determine actual performance.
Combine radix-style distribution with comparison sorting for appropriate subproblems.
WHY USE THIS IDEA?Numeric or string keys for which radix partitioning can cooperate with comparison-sort fallbacks.
THE STORY / CHARACTERISTICSteven Ross’ work became part of Boost.Sort.
The catch. Numeric representation, range and fallback thresholds matter; the name is not a guarantee of beating every comparison sort.
Begin with quicksort; switch to heapsort if recursion grows too deep.
WHY USE THIS IDEA?General-purpose library sorting that needs both quicksort-like speed and worst-case protection.
THE STORY / CHARACTERISTICMusser turned an algorithm’s own behaviour into a signal to change strategy.
The catch. It retains quicksort’s practical appeal while placing a bound on pathological partitions.
Find natural runs, extend short ones and merge while respecting a scheduling policy.
WHY USE THIS IDEA?Data arriving as several already ordered runs, such as concatenated sorted batches.
THE STORY / CHARACTERISTICTim Peters’ design treats pre-existing order as a resource.
The catch. The original merge policy and current CPython’s Powersort policy should not be conflated.
Choose a nearly optimal merge tree from the positions and lengths of adjacent runs.
WHY USE THIS IDEA?Stable library sorting that should preserve and efficiently combine existing runs.
THE STORY / CHARACTERISTICMunro and Wild’s policy is documented in CPython’s list-sort implementation.
The catch. It improves how runs are combined, not the definition of a comparison or a universal CPU speed limit.
Peek around the middle to find runs and recursively organise their merges.
WHY USE THIS IDEA?A run-aware stable sort whose merge schedule is constructed recursively around runs near a midpoint.
THE STORY / CHARACTERISTICIntroduced alongside Powersort as another way to use existing runs well.
The catch. Similar objective, different merge-tree construction. “Adaptive” needs a specified measure of order.
Extend run-aware merge scheduling to combine more than two runs at a time.
WHY USE THIS IDEA?An investigation of merging several existing runs together to reduce data transfers across merge levels.
THE STORY / CHARACTERISTICThe research targets data transfers as well as comparisons.
The catch. Results for a four-way implementation describe tested workloads, not a universal multiplier.
Use keys inside the array as workspace for block merging.
WHY USE THIS IDEA?Stable array sorting when an external record buffer is unavailable and internal block management is acceptable.
THE STORY / CHARACTERISTICAndrey Astrelin’s implementation pursues stability and constant external memory together.
The catch. Internal buffers and duplicate handling make the implementation more complex than textbook merge sort.
Merge blocks using a small internal working area rather than a full second array.
WHY USE THIS IDEA?A stable block-merge implementation for exploring the cost of replacing large buffers with rotations and searches.
THE STORY / CHARACTERISTICMike Wikström’s implementation demonstrates a practical stable block-sort approach.
The catch. Constant extra space is not free: rotations, searches and block bookkeeping still cost work.
Detect bad partitions and useful order, disturb patterns and fall back when necessary.
WHY USE THIS IDEA?General-purpose unstable sorting that should recognise or disrupt patterns leading to bad partitions.
THE STORY / CHARACTERISTICOrson Peters’ pdqsort explicitly fights inputs that repeatedly fool pivot selection.
The catch. Some branchless benefits depend on cheap comparisons and the type being sorted.
Record partition decisions in blocks before moving the misplaced elements.
WHY USE THIS IDEA?A processor-sensitive implementation where reducing unpredictable branches can justify partition buffers.
THE STORY / CHARACTERISTICEdelkamp and Weiss target branch mispredictions, a cost hidden by a simple comparison count.
The catch. Same broad quicksort idea, different interaction with a modern processor.
Build small ordered groups and use a four-way merging strategy.
WHY USE THIS IDEA?A stable merge design whose four-way merge organisation can be evaluated against ordinary two-way merging.
THE STORY / CHARACTERISTICIgor van den Hoven’s implementation emphasises predictable comparison and movement patterns.
The catch. Repository benchmarks are author experiments; speed depends on data types, compiler and hardware.
Use adaptive analysis and stable partitioning with merging machinery.
WHY USE THIS IDEA?Stable sorting where a record buffer is available and adaptive partitioning can cooperate with merging.
THE STORY / CHARACTERISTICA stable quicksort/mergesort hybrid from van den Hoven.
The catch. This is a concrete engineered combination, not proof that either parent family has become obsolete.
Pursue the partitioning approach with limited workspace and without stability.
WHY USE THIS IDEA?An unstable partitioning design when limiting workspace is more important than preserving equal-key order.
THE STORY / CHARACTERISTICRelated to Fluxsort, with a different memory and stability tradeoff.
The catch. Use the implementation’s own guarantees and benchmarks rather than assuming a sibling has identical properties.
Combine adaptive merging with stable quicksort and delayed merge decisions.
WHY USE THIS IDEA?Stable sorting of data that may offer both useful runs and repeated keys for a hybrid to exploit.
THE STORY / CHARACTERISTICPeters’ implementation draws on both run structure and duplicate-aware partitioning.
The catch. Its practical behaviour depends on more than a single textbook recurrence.
Combine stable quicksort with merging and detection of useful existing order.
WHY USE THIS IDEA?The stable slice-sorting role described in Rust’s 1.81 release, where equal-key order must be preserved.
THE STORY / CHARACTERISTICRust 1.81 adopted driftsort for stable slice sorting.
The catch. An adoption date, not a claim that the entire design was invented on release day.
Combine quicksort’s fast partitions with safeguards and specialised small-input handling.
WHY USE THIS IDEA?The unstable slice-sorting role described in Rust’s 1.81 release, allowing equal-key order to change.
THE STORY / CHARACTERISTICRust 1.81 adopted ipnsort for unstable slice sorting.
The catch. Stable and unstable library APIs promise different behaviour for equal keys.
Build sequences rising then falling, then compare across distances to merge them.
WHY USE THIS IDEA?A fixed comparison schedule suited to studying parallel rounds or hardware-like comparator organisation.
THE STORY / CHARACTERISTICA fixed wiring diagram can run many independent comparisons at once.
The catch. Depth measures parallel stages, not the total work of all comparators.
Recursively merge odd and even positions, then repair neighbouring outputs.
WHY USE THIS IDEA?A comparison network that should use a fixed recursive merging schedule, independent of observed key values.
THE STORY / CHARACTERISTICA second classic Batcher construction with a predetermined comparison schedule.
The catch. It is different from the adjacent odd-even transposition algorithm.
Alternate disjoint pairs (0,1),(2,3) and (1,2),(3,4).
WHY USE THIS IDEA?A nearest-neighbour model where disjoint adjacent comparisons can happen in the same round.
THE STORY / CHARACTERISTICBubble-like local movement arranged so independent neighbours can work simultaneously.
The catch. More processors reduce elapsed stages but do not erase total quadratic work.
Use expander-based constructions to obtain an asymptotically shallow sorting network.
WHY USE THIS IDEA?Understanding the theoretical possibility of logarithmic parallel depth, rather than choosing a simple practical sort.
THE STORY / CHARACTERISTICAjtai, Komlós and Szemerédi showed that logarithmic-depth sorting networks exist.
The catch. An asymptotic existence result does not imply an attractive small-input implementation.
Sample splitter keys, distribute values into ordered buckets, then sort each bucket.
WHY USE THIS IDEA?Partitioning work between processors using sampled boundaries, provided buckets remain sufficiently balanced.
THE STORY / CHARACTERISTICOnce bucket boundaries are correct, workers can sort their regions independently.
The catch. Sampling, skew and duplicate treatment determine whether work is balanced.
Use in-place block distribution and branchless splitter trees for parallel samplesort.
WHY USE THIS IDEA?Parallel in-place engineering where block buffers, locality and balancing work across threads matter.
THE STORY / CHARACTERISTICAxtmann and colleagues make memory locality and load balancing central design concerns.
The catch. “In-place” in parallel engineering can still include bounded buffers per worker.
Sort chunks that fit in memory, write ordered runs, then stream a multiway merge.
WHY USE THIS IDEA?A file or database export too large for RAM, where sequential reads and writes are valuable.
THE STORY / CHARACTERISTICWhen data exceeds RAM, transfers to storage become part of the algorithm’s cost.
The catch. The number of passes and available buffers can matter more than a small comparison saving.
Distribute runs unevenly among input tapes and rotate which tape receives output.
WHY USE THIS IDEA?A sequential-storage situation with a limited number of tape-like streams and a need to schedule merge passes.
THE STORY / CHARACTERISTICA design shaped by a limited number of sequential-access storage devices.
The catch. Its cleverness addresses a particular I/O model; it is not a universal modern in-memory sort.
Recursively merge through buffered funnels at several scales.
WHY USE THIS IDEA?Studying cache-efficient sorting without supplying the algorithm with the cache’s specific size.
THE STORY / CHARACTERISTICA cache-oblivious design seeks good transfers without being told cache sizes.
The catch. The theoretical I/O guarantee assumes the paper’s cache model and tall-cache condition.
Move the largest remaining pancake to the top, then flip it to the bottom.
WHY USE THIS IDEA?A constrained-move puzzle: useful for learning to design a procedure around operations you are allowed to use.
THE STORY / CHARACTERISTICBill Gates coauthored a paper on bounds for sorting by prefix reversal.
The catch. Their bounds research is not the same as inventing the puzzle. Only prefix reversals are legal moves.
Represent nonnegative integers as rows of beads; let the beads settle into ordered row lengths.
WHY USE THIS IDEA?A physical-model thought experiment about representing positive integers as beads and accounting for the apparatus.
THE STORY / CHARACTERISTICArulanandham, Calude and Dinneen explored a physical model of sorting.
The catch. A fast physical settling step does not include all encoding, hardware or simulation costs; M is the maximum value.
Randomly shuffle and check whether the result is ordered. Repeat.
WHY USE THIS IDEA?A counterexample showing that eventually finding an answer is very different from having a practical procedure.
THE STORY / CHARACTERISTICA correct sorted result can come from an absurdly unhelpful search strategy.
The catch. Uniform independent shuffles eventually succeed with probability one, but have no finite worst-case attempt bound.
Sort the first two thirds, the last two thirds and the first two thirds again.
WHY USE THIS IDEA?A recursion exercise that exposes the cost of solving overlapping subproblems repeatedly.
THE STORY / CHARACTERISTICOverlapping recursive work turns a simple idea into a very expensive one.
The catch. The exponent is log(3)/log(3/2). A divide-and-conquer shape alone does not promise efficiency.
Recursively find maxima in two halves, put the larger last, then sort the remaining prefix again.
WHY USE THIS IDEA?A deliberate inefficiency example for learning to analyse recursive work rather than judging code by its length.
THE STORY / CHARACTERISTICBroder and Stolfi inverted the usual optimisation objective in their pessimal-algorithms work.
The catch. It deliberately repeats work; a concise recursive definition need not be fast.
Start a timer for each value and emit when it wakes.
WHY USE THIS IDEA?A thought experiment about clocks, parallel tasks and hidden scheduling costs.
THE STORY / CHARACTERISTICIt tries to turn numeric order into waking order.
The catch. Real timers jitter, task starts differ and negatives need handling. The scheduler has inherited much of the problem.
Discard each value smaller than the last retained one.
WHY USE THIS IDEA?A counterexample for testing specifications. Deletion is valid filtering, but is not full sorting.
THE STORY / CHARACTERISTICThe joke exposes a missing requirement: a sorted-looking output can lose data.
The catch. It produces a nondecreasing subsequence, not a permutation of the full input. A merge-based repair would be a different algorithm.
For every i and every j, swap when A[i] < A[j]. The output is ascending.
WHY USE THIS IDEA?Testing an initially surprising loop structure, then explaining its correctness through an ordered-prefix invariant.
THE STORY / CHARACTERISTICFung found it while deliberately constructing wrong algorithms; the classroom detail is unverified.
The catch. Symmetric-looking loops hide asymmetric progress. It is correct but needlessly quadratic even on ordered input.
Use repeated recursion to intentionally take exponential time.
WHY USE THIS IDEA?An intentionally reluctant sorting construction used to explore exponential work rather than reduce it.
THE STORY / CHARACTERISTICAbrahamsen’s paper pursues reluctant sorting, continuing the tradition of deliberately inefficient algorithms.
The catch. This is mathematical humour with a real cost analysis, not a performance recommendation.
Fit a model estimating where a value belongs; distribute it and repair remaining disorder.
WHY USE THIS IDEA?Numeric sorting where a learned estimate of rank may guide distribution and repair can restore exact order.
THE STORY / CHARACTERISTICMachine learning helps while sorting the data, unlike AlphaDev’s offline program discovery.
The catch. Model error, duplicates and training overhead must be included in the workload.
Redesign learned distribution to handle repeated keys more effectively.
WHY USE THIS IDEA?Studying how a learned distribution sort handles the repeated keys that challenged its earlier design.
THE STORY / CHARACTERISTICThe authors identified high-duplicate inputs as a weakness in the original design.
The catch. A useful example of adversarial data exposing an assumption in a promising algorithm.
Search for correct, low-latency assembly programs for tiny sorting tasks.
WHY USE THIS IDEA?Tiny fixed-size subroutines called inside a larger library sort. The learning happens before deployment.
THE STORY / CHARACTERISTICReinforcement learning found routines incorporated into LLVM’s libc++ sorting code.
The catch. These are small building blocks. They do not remove the Ω(n log n) comparison lower bound for arbitrary n.
Combine integer-sorting techniques with special treatment of frequent keys.
WHY USE THIS IDEA?Parallel integer-sorting research in which representation and frequent keys are part of the computational model.
THE STORY / CHARACTERISTICA theory-and-practice study of sorting integers in parallel.
The catch. Integer representation, duplication and processor model are essential to interpreting its guarantees.
Measure order using richer parameters than input length and adapt partition-based sorting to them.
WHY USE THIS IDEA?Studying a formal notion of optimality that depends on richer input parameters than length alone.
THE STORY / CHARACTERISTICSen’s work asks what it should mean for an algorithm to be universally optimal.
The catch. This is a defined theoretical notion, not “fastest for every real-world input”.
Select among sorting strategies using observed properties of the input.
WHY USE THIS IDEA?Examining the cited proposal’s strategy-selection rules and the assumptions behind its reported comparisons.
THE STORY / CHARACTERISTICThe specific research proposal linked below studies selection between strategies; this label is not a unique name for every adaptive hybrid.
The catch. Author-reported comparisons need independent reproduction; do not treat a promising title as a universal guarantee.
Use a binary-quicksort-derived method for signed, unsigned and floating-point representations.
WHY USE THIS IDEA?Research on sorting different numeric representations using a binary-quicksort-derived framework.
THE STORY / CHARACTERISTICGuzmán proposes one representation-aware framework for several numeric types.
The catch. The reported bound includes word width. Representation and floating-point ordering conventions are not optional details.
Recursively refine value intervals; clean small buckets with insertion sort and fall back when splits fail.
WHY USE THIS IDEA?Exploring numeric interval refinement with cleanup and fallback when an interval split does not help.
THE STORY / CHARACTERISTICA 2026 distribution-sort proposal by Sučić, Vitasović and Petrušić.
The catch. Benchmark claims are the authors’ results, not reproduced here; read the full paper for workspace accounting.
Use an ordered-set structure to reduce comparison overhead while guaranteeing only linear moves.
WHY USE THIS IDEA?Research where moving records is expensive enough to make linear moves a distinct objective.
THE STORY / CHARACTERISTICXu and Chick focus on moving records as a separate resource from comparing them.
The catch. The near-optimal comparison statement is probabilistic; the paper also gives a distinct worst-case tradeoff.
Study sorting decisions when items arrive in random order under online constraints.
WHY USE THIS IDEA?Studying the cited online arrival model; its decisions and objective differ from sorting an available array.
THE STORY / CHARACTERISTICRecent theory explores what arrival assumptions buy an algorithm.
The catch. An online objective is not interchangeable with sorting an already available array. See the model before comparing bounds.
No matches. Try another name, idea or family.
THE FRONTIER / WHAT WAS NEW BY THE CUTOFF?
bsort proposes a binary-quicksort-derived method with reported O(wn) time, where w is word width. “Linear” needs that parameter in view. ↗
Need for Speed Sort refines value buckets, then uses cleanup and fallback mechanisms. Its reported results are conditional on the paper’s workloads. ↗
Minimal-move sorting separates moves from comparisons. The reported randomised result achieves linear moves and near-optimal comparisons with a stated probability guarantee. ↗
These sources were available before 13 September 2026. This page verifies attribution and summarises stated models; it does not independently reproduce their proofs or performance benchmarks. The cutoff is a research boundary, not a claim that nothing else was published.