|
Non-Programming Exercises:
H(0) = 1 because there is only one tree with height 0, namely a tree with a root node, no children, and no subtrees.
H(1) = 2, H(2) = 4, H(3) = 7, as illustrated below. (For h > 1 there are many different minimal AVL trees.)
O O O
/ / \ / \
/ / \ / \
O O O O O
\ / \ \
\ / \ \
O O O O
\
\
O
| 0 1 |
A = | |
| 1 1 |
Prove by induction that T(n) = (3/2)*n - 2, for all n > 2, n = 2k, k > 1.. [Hint: You are used to assuming a formula true for n and then proving it true for n + 1. In this case, though, you need to go from n to 2*n. Don't forget the basis.]