Which of the following correctly matches a graph traversal algorithm with its commonly associated data structure?

Options

  • A. BFS - Queue
  • B. DFS - Queue
  • C. BFS - Stack only
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. BFS - Queue

Detailed Explanation

The standard association is BFS → Queue and DFS → Stack/Recursion. BFS uses FIFO processing to explore a graph level by level, while DFS uses LIFO behavior to explore deeply before backtracking. These associations are fundamental for understanding graph traversal implementations. A visited array or set is generally maintained in both algorithms to prevent repeatedly processing the same vertices.