GateAI
Trees

GATE CSE 2016 Set 2 · Q11

NAT1 markEasy

Time

Breadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is a vertex tt at a distance four from the root. If tt is the nn-th vertex in this BFS traversal, then the maximum possible value of nn is _________.

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 31

Trees

Breadth First Search (BFS) on a tree traverses all vertices level by level, starting from the root at level 00 (distance 00).

The maximum number of nodes at any level kk in a binary tree is 2k2^k.

To maximize the traversal index nn of a vertex tt located at distance 44 (level 44):

  1. All previous levels (0,1,2,30, 1, 2, 3) must contain the maximum possible number of nodes.

  2. The vertex tt must be visited as the very last node at level 44.

The maximum number of nodes from level 00 to level 44 is:

∑k=042k=20+21+22+23+24=1+2+4+8+16=31\sum_{k=0}^{4} 2^k = 2^0 + 2^1 + 2^2 + 2^3 + 2^4 = 1 + 2 + 4 + 8 + 16 = 31

Thus, the maximum possible value of nn is 31.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Trees previous year question is Q11 of the GATE CSE 2016 Set 2 paper. Find more GATE CSE PYQs on Trees in Programming and Data Structures, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Trees PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Trees in GATE CSE

Trees has 13 GATE CSE PYQs across 11 papers from 2012 to 2026. 5 of them are 1-mark NAT questions like this one, and GATE CSE 2016 Set 2 has 2.

How GATE tests Trees

More from GATE CSE 2016 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2016 Set 2 · Q11 · NAT

Breadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is a vertex t at a distance four from the root. If t is the n-th vertex in this BFS traversal, then the maximum possible value of n is …

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.