Question

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
Official answer and solution
Official answer
A
From
Official GATE 2015 answer key

Solution

Apply tree depth formulas to determine minimum and maximum nodes in a binary tree of height h.

Given that height h=5h = 5 is defined as the length of the longest root-to-leaf path (number of edges):

  1. Minimum number of nodes:
    Occurs in a degenerate binary tree where every internal node has exactly one child. The number of nodes on a path with 5 edges is:

    Nmin⁡=h+1=5+1=6.N_{\min} = h + 1 = 5 + 1 = 6.
  2. Maximum number of nodes:
    Occurs in a complete, full binary tree where every level ii (from 00 to 55) is completely filled:

    Nmax⁡=∑i=052i=25+1−1=26−1=64−1=63.N_{\max} = \sum_{i=0}^{5} 2^i = 2^{5+1} - 1 = 2^6 - 1 = 64 - 1 = 63.

Therefore, the maximum and minimum numbers of nodes are 6363 and 66, respectively (option A).

Final answer

A

Common trap

Defining height as the number of nodes on the longest path instead of edges, which would give 31 and 5.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2015 Computer Science and Information Technology (CS) Session 1
Question
35 of 65, printed as CS Q.25
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.