ISRO Scientist/Engineer CSE 2020Data Structures › Not yet assigned to a topic
ISRO Scientist/Engineer CSE 2020 PYQ: The minimum height of an AVL tree with $n$ nodes is
The minimum height of an AVL tree with $n$ nodes is
- A$\text{Ceil } (\log_2(n+1))$
- B$1.44\ \log_2n$
- C$\text{Floor } (\log_2(n+1))$Correct answer
- D$1.64\ \log_2n$
Answer
(C) $\text{Floor } (\log_2(n+1))$
Approach
The minimum height of an AVL tree with n nodes occurs when the tree is as balanced as possible, i.e., a complete binary tree. For a complete binary tree of height h, the maximum number of nodes is $2^{h+1} - 1. \text{Setting} n = 2^{h+1} - 1 \text{and solving for} h \text{gives} h = floor(log2(n+1)).$
Reviewed by ISRO IQ Editorial Team.