in DS
8,028 views
2 votes
2 votes

What is the worst case possible height of an AVL tree??

a.   2logn  (Assume base of log is 2) 

 b. 1.44log n  (Assume base of log is 2)

c. Depends upon implementation

d. Theta(n)

in DS
8.0k views

1 Answer

4 votes
4 votes
Best answer

What is the minimum number of nodes (sparsest possible AVL tree) an AVL tree of height h can have ?

| Fh| = | Fh - 1| + | Fh - 2| + 1
| Fh| + 1 = (| Fh - 1| + 1) + (| Fh - 2| + 1)
| Fh| + 1 $\displaystyle \approx$ $\displaystyle {\frac{1}{\sqrt{5}}}$ $\displaystyle \left(\vphantom{\frac{1+\sqrt{5}}{2}}\right.$ $\displaystyle {\frac{1+\sqrt{5}}{2}}$ $\displaystyle \left.\vphantom{\frac{1+\sqrt{5}}{2}}\right)^{h+3}_{}$
$ \Rightarrow$
$h  \approx 1.44 \log| Fn|$
$ \Rightarrow$
The sparsest possible AVL tree with n nodes has height 
$$h \displaystyle \approx 1.44\log n$$
$ \Rightarrow$
The worst case height of an AVL tree with n nodes is
$$1.44\log n$$
B is the correct answer
selected by

2 Comments

how it's come

| Fh| + 1 ≈≈ 1/√5 ((1+√5)/2 )^h+3
0
0

Related questions

1 vote
1 vote
1 answer
3