|
|
|
Note:
|
n(h) = 1 + n(h−1) + n(h−2) ...... (1)
n(1) = 1
n(2) = 2
|
math
In[0]:= RSolve[ {n[h]==1+n[h-1]+n[h-2], n[0]==1, n[1]==2}, n[h], h ]
Out[0]= {{n[h] -> -1 + 2 Fibonacci[h] + LucasL[h]}}
Which is equals to:
/ 1/2 \ / 1/2\h / 1/2 \ / 1/2\h
|3 5 | | 5 | | 3 5 | | 5 |
|------ + 1/2| |1/2 + ----| + |- ------ + 1/2| |1/2 - ----| - 1
\ 10 / \ 2 / \ 10 / \ 2 /
1/2 / 2 \h 1/2 / 2 \h
2 5 |- --------| 2 5 |- --------|
| 1/2| | 1/2|
\ 1 - 5 / \ 1 + 5 /
- -------------------- + --------------------
1/2 1/2
5 (1 - 5 ) 5 (1 + 5 )
approximately equal to ~= 2 × 1.6h
|
Example:
> -1 + 2 Fibonacci[5] + LucasL[5]
20
> 2*1.6^5
20.9715
|
n(h) = minimum number of nodes in an AVL tree of height h
~= 2 × 1.6h ....... (2)
|
|
m(h) > min. # nodes in AVL tree of height h
> n(h)
> 2 × 1.6h
|
|
(This was a rough estimate, I gave you a more accurate estimate above)
|
|