AVL Tree · Data Structures
7 questions · asked in 6 of 27 years (2000–2026)
MCQ 6 · NAT 11-mark 4 · 2-mark 3
Questions 6–7 of 7
Answer: (B)
At the root, the tree is balanced, so each side has about leaves and the cost is .
At the next level there are 2 nodes. The cost of computing for each of them is . So the total cost at the second level is . In the same way, at each level (this is the total cost for the level, not the cost for one node) the cost is . A balanced tree has levels, so the total is .
The nodes on one level have no leaves in common, so each level costs at most in any balanced tree. That gives the upper bound , and the example above shows it is reached.
If we change to in the definition of , we still get the same answer.
Answer: (B)
Answer: (D)
Let a node have nodes in its left sub-tree and in its right. The rule gives (and the same the other way round). So the bigger sub-tree has at most twice as many nodes as the smaller one.
The tallest tree is made when every node sends as many nodes as possible to one side. Say . Then , so and . The bigger sub-tree holds at most about of the nodes.
The longest path always goes into the bigger sub-tree, so with height counted in nodes:
Unroll it: after steps the size is about and the height is . The size reaches 1 when , that is , so .
So the maximum height is best described by . Option (B), , would need the bigger side to hold of the nodes, which the rule does not allow.
Answer: (D)
Keep practising