Which of the following is useful in traversing a given graph by Breadth-First…

2018

Which of the following is useful in traversing a given graph by Breadth-First Search (BFS)?

  1. A.

    Stack

  2. B.

    Set

  3. C.

    List

  4. D.

    Queue

Attempted by 1375 students.

Show answer & explanation

Correct answer: D

Correct data structure: Queue (FIFO) . Why: BFS explores nodes level by level. A queue (first-in, first-out) ensures that nodes discovered earlier are processed before nodes discovered later, producing the breadth-first order. Initialize the queue with the start node and mark it visited.

Explore the full course: Up Lt Grade Assistant Teacher 2025