Given a list of numbers, we could create a complete binary search
tree.
- Sort A.
- Pick i as the appropriate halfway point. Let i be the root.
- Make a complete binary search tree out of A[1] through A[i-1]
and make it the left subtree. Do the same with A[i+1] through
A[n] and make it the right subtree.
Extra credit: Give a rule for picking i. Show that resulting
tree is complete (i.e., deepest level is ``left justified''.)
Running time?
Next: Recovering from Bad Luck
Up: ROTATIONS
Previous: ROTATIONS