Related Articles

Related Articles

GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 22
  • Last Updated : 21 Jan, 2020

Consider the following graph. Suppose we want to traverse it, starting at node A.

Which of the following option is correct regarding these traversing orders ?

I. A, G, F, B, C, H, D, E
II. A, G, H, F, C, D, E, B
III. A, C, B, F, G, D, H, E
IV. A, B, C, E, D, F, H, G 

(A) I and II are BFS, III and IV are DFS
(B) I and III are BFS, II and IV are DFS.
(C) I and IV are BFS, II and IV are DFS
(D) II and IV are BFS, I and III are DFS


Answer: (B)

Explanation: Here are two possible orderings for BFS:

• A, G, F, B, C, H, D, E
• A, C, B, F, G, D, H, E 

Here are two possible orderings for DFS:



• A, G, H, F, C, D, E, B
• A, B, C, E, D, F, H, G 

So, I and III are BFS, II and IV are DFS.

Option (B) is correct.

Quiz of this Question

sudo-gate-course

My Personal Notes arrow_drop_up
Recommended Articles
Page :