 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Only
the number of items and their order is important
|
|
|
– |
Can
restrict our attention to BSTs containing items {1,…, n}
|
|
|
| • |
We
assume that each item is equally likely to appear
|
|
|
|
as
the root
|
|
|
| • |
Define
H(n) º expected height of BST of size n
|
|
|
| • |
If
item i is the root then expected height is
|
|
|
|
1 + max { H(i-1), H(n-i) }
|
|
|
|
We
average this over all possible i
|
|
|
| • |
Can
solve the resulting recurrence (by induction)
|
|
|
|
H(n) = O(log n)
|
|