Time vs. Height
The worst-case time for a
sorting method must be ³ the
height of its comparison tree
The height corresponds to
the worst-case number of
comparisons
Each comparison takes
Q(1) time
The algorithm is doing more
than just comparisons
What is the minimum
possible height for a binary
tree with n! leaves?
Height ³ log(n!) = Q(n log n)
This implies that any
comparison-based sorting
algorithm must have a worst-
case time of W(n log n)
Note: this is a lower bound;
thus, the use of big-Omega
instead of big-O
CS409 - Spring 2000
3