GATE | GATE CS 2021 | Set 2 | Question 26
Consider a complete binary tree with 7 nodes. Let A denote the set of first 3 elements obtained by performing Breadth-First Search (BFS) starting from the root. Let B denote the set of first 3 elements obtained by performing Depth-First Search (DFS) starting from the root.
The value of ∣A−B∣ is _____________ .
(A) 1
(B) 2
(C) 3
(D) 4
Answer: (A)
Explanation: In case of BFS if we draw complete binary tree then in Set A we have level1+level2.
In DFS we have level1+ level 2 + level 3.
So A-B= remaining element of level 2.
Quiz of this Question
Last Updated :
13 Aug, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...