Comparison Trees
Every sorting algorithm has
a corresponding comparison
tree
Note that other stuff
happens during the sorting
algorithm, we just aren’t
showing it in the tree
The comparison tree must
have n! (or more) leaves
because a valid sorting
algorithm must be able to get
any of n! possible answers
Comparison tree for sorting
n items:
comparison
tree
n! leaves
CS409 - Spring 2000
2