GATE | GATE-CS-2016 (Set 2) | Question 21
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 ________
[This Question was originally a Fill-in-the-blanks Question]
(A) 15
(B) 16
(C) 31
(D) 32
Answer: (C)
Explanation: It would be node number 31 for given distance 4.
For example if we consider at distance 2, below highlighted node G can be the farthest node at position 7.
A
/ \
B C
/ \ / \
D E F G
Alternative Solution :
t is the n-th vertex in this BFS traversal at distance four from the root. So height of tree is 4.
Max number of nodes = 2^{h+1} − 1 = 2^{5} − 1 = 31
At distance four, last node is 31. option (C)
Quiz of this Question
Recommended Posts:
- GATE | GATE-CS-2015 (Mock Test) | Question 9
- GATE | GATE-CS-2015 (Mock Test) | Question 8
- GATE | GATE-CS-2015 (Mock Test) | Question 10
- GATE | GATE-CS-2015 (Mock Test) | Question 10
- GATE | GATE-CS-2015 (Mock Test) | Question 5
- GATE | GATE-CS-2015 (Mock Test) | Question 4
- GATE | GATE-CS-2015 (Mock Test) | Question 17
- GATE | GATE-CS-2015 (Mock Test) | Question 2
- GATE | GATE-CS-2015 (Mock Test) | Question 10
- GATE | GATE-CS-2015 (Mock Test) | Question 11
- GATE | GATE-CS-2015 (Mock Test) | Question 17
- GATE | GATE-CS-2015 (Mock Test) | Question 16
- GATE | GATE-CS-2015 (Mock Test) | Question 17
- GATE | GATE-CS-2015 (Mock Test) | Question 14
- GATE | GATE-CS-2015 (Mock Test) | Question 13



