The height of a tree is the length of the longest root-to-leaf path in it. The maximum and minimum number of nodes in a binary tree of height are
View worked solution
Answer: A
Given that the height of a tree is the length of the longest root-to-leaf path (measured in terms of the number of edges):
- A tree with height consists of exactly node (the root).
- For a binary tree of height :
1. Minimum number of nodes ():
The minimum number of nodes occurs when the tree is completely skewed (each internal node has exactly one child).
For :
2. Maximum number of nodes ():
The maximum number of nodes occurs when the tree is a perfect binary tree (every level is completely filled).
For :
Thus, the maximum and minimum number of nodes in a binary tree of height are and , respectively.
Free practice · Your answers on this page are not saved.
