Skip to content
Official PYQ · 2015

GATE CS 2015 Set 1 Q25 — Trees

Explain with AI

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 55 are

Choose one option
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 h=0h = 0 consists of exactly 11 node (the root).
  • For a binary tree of height hh:

1. Minimum number of nodes (Nmin⁡N_{\min}):
The minimum number of nodes occurs when the tree is completely skewed (each internal node has exactly one child).
Nmin⁡=h+1N_{\min} = h + 1
For h=5h = 5:
Nmin⁡=5+1=6N_{\min} = 5 + 1 = 6

2. Maximum number of nodes (Nmax⁡N_{\max}):
The maximum number of nodes occurs when the tree is a perfect binary tree (every level is completely filled).
Nmax⁡=2h+1−1N_{\max} = 2^{h+1} - 1
For h=5h = 5:
Nmax⁡=25+1−1=26−1=64−1=63N_{\max} = 2^{5+1} - 1 = 2^6 - 1 = 64 - 1 = 63

Thus, the maximum and minimum number of nodes in a binary tree of height 55 are 6363 and 66, respectively.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Trees questions