How many minimum nodes are required to attain a height of 6 in AVL tree ?

(A) 11
(B) 22
(C) 33
(D) 44


Answer: (C)

Explanation: Minimum nodes required to attain height h:

N(6) = N(5) + N(4) + 1……I
N(5) = N(4) + N(3) + 1……II
N(4) = N(3) + N(2) + 1……III
N(3) = N(2) + N(1) + 1……IV
N(2) = N(1) + N(0) + 1…….V
N(2) = 2 + 1 + 1 = 4
Replace N(2) = 4 in IV
N(3) = N(2) + N(1) + 1
N(3) = 4 + 2 + 1 = 7
replace this value in III
N(4) = N(3) + N(2) + 1
N(4) = 7 + 4 + 1 = 12
replace this in II
N(5) = N(4) + N(3) + 1
N(5) = 12 + 7 + 1 = 20
replace N(5) and N(4) in I
N(6) = 20 + 12 + 1 = 33.
33 minimum nodes are required to attain height of 6 in AVL tree.
So, option (C) is correct.

Quiz of this Question


  • Last Updated : 26 Dec, 2018

Share your thoughts in the comments