minimum number of nodes in the AVL tree for a tree with height h. The following equation should demonstrate the recursive call of the function N (h).
formula N(h)=1+N(h-1)+N(h-2)
Since we know that N(0)=1 ,N(1) = 2, N(2) = 4, for example: we can reduce the following expression for these known for h = 6.
N(3)=1+N(3-1)+N(3-2)=1+N(2)+N(1)=7
N(4)=1+N(4-1)+N(4-2)=1+N(3)+N(2)=12
N(5)=1+N(5-1)+N(5-2)=1+N(4)+N(3)=20
N(6)=1+N(6-1)+N(6-2)=1+N(5)+N(4)=33
source
share