GATE CS 2017, set 2 · Question 15 · Algorithms · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer

The Breadth First Search (BFS) algorithm has been implemented using the queue data structure. Which one of the following is a possible order of visiting the nodes in the graph below?

Undirected graph with six nodes arranged in two rows. Top row from left to right: M, N, O. Bottom row from left to right: R, Q, P. R is directly below M, Q is directly below N, P is directly below O. Edges: M–N, N–O, M–R, M–Q (diagonal), N–Q, O–Q (diagonal), O–P, Q–P. R has no other edges.
  1. (A) MNOPQR
  2. (B) NQMPOR
  3. (C) QMNROP
  4. (D) POQNMR
Answer

Answer (D)

Answer from the official GATE CS 2017 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes