Data Structures & AlgorithmsModerateGATE CS · Product-company placement
What is the minimum possible number of nodes in an AVL tree of height 3? (Height counts edges on the longest root-to-leaf path, so a single node has height 0; in an AVL tree the two subtrees of every node differ in height by at most one.)
- A. 8
- B. 7
- C. 15
- D. 6
Correct answer: B. 7
A minimum AVL tree of height h has a root with subtrees of heights h − 1 and h − 2, so N(h) = N(h − 1) + N(h − 2) + 1 with N(0) = 1 and N(1) = 2. The +1 for the root is what the trap options drop.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- What is the minimum possible number of nodes in an AVL tree of height 4? (Height counts edges on the longest root-to-leaf path, so a…
- What is the minimum possible number of nodes in an AVL tree of height 5? (Height counts edges on the longest root-to-leaf path, so a…
- What is the minimum possible number of nodes in an AVL tree of height 6? (Height counts edges on the longest root-to-leaf path, so a…
- What is the minimum possible number of nodes in an AVL tree of height 7? (Height counts edges on the longest root-to-leaf path, so a…
- What is the minimum possible number of nodes in an AVL tree of height 8? (Height counts edges on the longest root-to-leaf path, so a…
- What is the minimum possible number of nodes in an AVL tree of height 9? (Height counts edges on the longest root-to-leaf path, so a…