Let be a binary search tree with nodes. The minimum and maximum possible heights of are:
Note: The height of a tree with a single node is .
View worked solution
Answer: B
To find the minimum and maximum possible heights of a Binary Search Tree (BST) with nodes, we use the definition that the height of a single-node tree is .
1. Maximum Height
The maximum height occurs when the tree is completely skewed (either left-skewed or right-skewed), where each level contains exactly one node.
For a skewed tree with nodes, the height is given by:
Substituting :
2. Minimum Height
The minimum height occurs when the tree is as balanced as possible (a perfect binary tree).
For a binary tree of height , the maximum number of nodes it can accommodate is:
We need to find the minimum height such that the tree can accommodate nodes:
For , the maximum number of nodes is . Thus, a perfectly balanced binary tree of height can accommodate exactly nodes.
Therefore, the minimum and maximum possible heights of are 3 and 14 respectively.
Free practice · Your answers on this page are not saved.
