Comparison Sorts
Updated 2026-08-17
INTRODUCTION
English translation pending.
CORE DEFINITION
Comparison sorts are algorithms that determine order solely by asking whether one element is less than another. Quicksort, devised by Tony Hoare in 1959, merge sort, described by John von Neumann in 1945, and heapsort, published by J. W. J. Williams in 1964, are the standard examples. A decision-tree argument shows that distinguishing all n! possible orderings requires at least a number of comparisons proportional to n log n, so no comparison sort can beat that bound in the worst case. The bound applies only to comparison-based methods: counting sort and radix sort sidestep it by using the values themselves as addresses.
SCAFFOLDING EFFECT
Reduce cognitive load
- Algorithm choice: Check whether values can be used as addresses before defaulting to a comparison sort. - Cost estimate: Use the n log n bound to sanity-check whether a sorting step can fit your budget. - Data-shape check: Ask whether the input is nearly sorted or adversarially ordered before picking an implementation.
Anchor fast decisions
Each comparison yields at most one bit of information, because it can only answer yes or no. There are n factorial possible orderings, so identifying the correct one requires at least log base two of n factorial comparisons, and Stirling's approximation turns that into a bound proportional to n log n. Any comparison-based algorithm therefore has to spend at least that many comparisons in the worst case, no matter how cleverly it chooses which pair to compare.
MINIMUM ACTION
In progress 0/1Practice this model in one real situation:
account_treeGenealogyexpand_more
menu_bookReferencesexpand_more
Source support: Explicit
- github.comhttps://github.com/kcchien/model-thinkingverified
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS