next up previous
Next: Up: Previous:

Analysis Of Decision Tree Model

Worst Case Comparisons is equal to height of decision tree

Lower bound on the worst case running time is the lower bound on the height of the decision tree.

Note that the number of leaves in the decision tree $\geq$ n!, where n = number elements in the input sequence.

A binary tree of height h has \(\leq 2^h\) leaves.

n! \(\leq 2^h\)
By Stirling Approximation n! = \(\sqrt{2 \pi n} (n/e)^n (1 + \Theta(1/n))\)
Thus n! >(n/e)n, h $\geq$ lg (n/e)n = nlgn - nlge = \(\Theta(nlgn)\)

h $\geq$ lg(n!) $\geq$ $\Theta(nlgn)$
h = $\Omega(nlgn)$

The best possible worst case running time for comparison sorts is thus nlgn.

Heapsort and Mergesort, both of which are O(nlgn), are asymptotically optimal.

next up previous
Next: Up: Previous: