The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height is:
View worked solution
Answer: C
The height of a binary tree is defined as the maximum number of edges from the root to any leaf node.
To maximize the number of nodes in a binary tree of height , the tree must be a perfect binary tree where every level is completely filled:
- Level (root level) has node.
- Level has nodes.
- Level has nodes.
- ...
- Level has nodes.
The total maximum number of nodes is the sum of nodes at all levels from to :
Using the formula for the sum of a geometric progression, we get:
Example: For a tree of height , the maximum number of nodes is (a root with two children), which matches option C.
Free practice · Your answers on this page are not saved.
