Which data structure is primarily associated with Breadth-First Search?

Options

  • A. Stack
  • B. Queue
  • C. Heap
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. Queue

Detailed Explanation

Breadth-First Search uses a queue because vertices must be processed in the same order in which they are discovered. This follows the FIFO (First In, First Out) principle. In contrast, iterative DFS normally uses a stack following LIFO behavior. Understanding the BFS-queue and DFS-stack relationship is a common DSA examination topic.