507 views
0 votes
0 votes

I want to derive a formula that, with n nodes how many AVL trees can possible.

we know that, with 0 ==> 1,with 1 ==> 1, with 2 ==> 2, with 3 ==> 1

with 4 ===> root is fixed ==> remaining 3 nodes we have to distribute on left side and right side

LEFT RIGHT POSSIBLE
3 0 Can't possible
2 1 possible ==> N(2) * N(1) = 2*1 =2
1 2 possible ==> N(1) * N(2) = 1*2 =2
0 3 Can't possible

===> N(4) = 2+2 =4

with 5 ===> root is fixed ==> remaining 4 nodes we have to distribute on left side and right side

LEFT RIGHT POSSIBLE
4 0 Can't possible
3 1 possible ==> N(3) * N(1) = 1*1 =1
2 2 possible ==> N(2) * N(2) = 2*2 =4
1 3 possible ==> N(1) * N(3) = 1*1 =1
0 4 Can't possible

===> N(5) = 1+4+1 =6

 

with 6 ===> root is fixed ==> remaining 5 nodes we have to distribute on left side and right side

LEFT RIGHT POSSIBLE
5 0 Can't possible
4 1 Can't possible
3 2 possible ==> N(3) * N(2) = 1*2 =2
2 3 possible ==> N(2) * N(3) = 2*1 =2
1 4 Can't possible
0 5 Can't possible

===> N(6) = 2+2 =4

 

with 7 ===> root is fixed ==> remaining 6 nodes we have to distribute on left side and right side

LEFT RIGHT POSSIBLE
6 0 Can't possible
5 1 Can't possible
4 2 possible ==> N(4) * N(2) = 4*2 =8
3 3 possible ==> N(3) * N(3) = 1*1 =1
2 4 possible ==> N(2) * N(4) = 2*4 =8
1 5 Can't possible
0 6 Can't possible

===> N(7) = 8+1+8 =17

Can't possible cases we can easily find by maximum height achieve by left nodes, and right nodes atmost differ by 1.

Can we simplify further.... i am not able to do further...

Please log in or register to answer this question.

Related questions

507
views
1 answers
1 votes
srestha asked Dec 18, 2018
507 views
Please derive this$1+2+4+........+\frac{n}{4}+\frac{n}{2}=2^{log n}-1$
806
views
1 answers
1 votes
tarun_svbk asked Feb 24, 2018
806 views
Which of the following is false for derivation tree of CFG- $G (V, T, P, S)$ ?The root is labeled $S$.Every leaf has a label from $V ⋃ T ⋃ \{ λ \}$.A vertex with ... $\text{1 & 2}$\text{2 & 3}$\text{Only 2}$
4.1k
views
1 answers
0 votes
Salazar asked Jan 29, 2018
4,119 views
Maximum height of a B+ tree of order m with n key values is (With Derivation), the answer is known Logceil(m/2) NI tried deriving but had some trouble, could someone assist with the derivation or derivation process ?
410
views
1 answers
2 votes
srestha asked Dec 28, 2017
410 views
What is the value of 1.111111111? Is it same as $\left (2-2^{-9} \right )$?