LOGBOOK

HELP

Quiz Entry - updated: 2026.11.27

Why is $\log_2(n!)$ at least $\frac{n}{2}\log_2\frac{n}{2}$, and what lower bound does that give every comparison sort?

The larger half of the factors in $n! = 1 \cdot 2 \cdots n$ are each at least $n/2$, so $n! \ge (n/2)^{n/2}$ and $\log_2(n!) \ge \frac{n}{2}\log_2\frac{n}{2}$, which grows like $n\log n$. Every comparison sort therefore needs $\Omega(n\log n)$ comparisons in the worst case.

The factors 1 to 8 of 8! as bars: the four largest each reach at least n/2 = 4, none exceeds n = 8

* Dropping the small factors and shrinking the large ones to n/2 can only make the product smaller. *

The estimate makes the product smaller in two steps: drop the factors $1, \ldots, n/2$ (each is at least 1), then replace each of the remaining $n/2$ factors by $n/2$ (each is at least that). What is left is $(n/2)^{n/2}$, and the logarithm turns the power into a product:

$$\log_2(n!) \;\ge\; \log_2\!\left(\left(\tfrac{n}{2}\right)^{n/2}\right) \;=\; \tfrac{n}{2}\,\log_2\tfrac{n}{2}$$

Making the product smaller is the right direction here. For an upper bound you may round generously upwards, the way an engineer designs a bridge for 55 tonnes when 50 are expected. A lower bound has to hold for certain, so every simplification must make the quantity smaller, never larger.

From the other side every factor is at most $n$, so $n! \le n^n$ and $\log_2(n!) \le n\log_2 n$. Squeezed between two functions that both grow like $n\log n$, $\log_2(n!)$ grows like $n\log n$ as well. Stirling's formula gives the precise value: $\log_2(n!) \approx n\log_2 n - 1.44\,n$, for example about 8 529 for $n = 1000$.

Notation: a lower bound is written with $\Omega$. "$\Omega(n\log n)$" means at least proportional to $n\log n$ for large $n$, just as $O$ means at most. Writing "$\ge O(n\log n)$" expresses the same idea informally.

Go deeper:

From Quiz: ADS / Sorting Lower Bound, Bucket-Sort and Radix-Sort | Updated: Nov 27, 2026