Why does a decision tree with $n!$ leaves force at least $\log_2(n!)$ comparisons in the worst case?
A binary tree of height $h$ has at most $2^h$ leaves. To hold $n!$ leaves it needs $2^h \ge n!$, so $h \ge \log_2(n!)$. The height is the number of comparisons on the longest path, and some input follows that path.
Each comparison splits the inputs that are still possible into at most two groups, so after $h$ comparisons at most $2^h$ different outcomes can be told apart. Distinguishing all $n!$ orders therefore takes at least $\lceil \log_2(n!) \rceil$ comparisons for the unluckiest input, whatever the algorithm does. In terms of information: one yes/no answer is one bit, and naming one of $n!$ orders takes $\log_2(n!)$ bits.
| $n$ | possible orders $n!$ | $\log_2(n!)$ | comparisons needed in the worst case |
|---|---|---|---|
| 3 | 6 | 2.58 | at least 3 |
| 4 | 24 | 4.58 | at least 5 |
| 5 | 120 | 6.91 | at least 7 |
| 10 | 3 628 800 | 21.8 | at least 22 |
For three, four and five elements these minimums can be met exactly: merge-sort sorts any four elements with 5 comparisons, and merge-insertion sort (Ford and Johnson) sorts any five with 7. Merge-sort needs 8 for five elements, one more than necessary.
Go deeper:
Comparison sort: number of comparisons required — the bound, how close real algorithms come, and the small cases computed exactly.
Merge-insertion sort — the algorithm built to use as few comparisons as possible.