What data structure is typically used to implement Breadth-First Search (BFS) graph traversal?

Answer and explanation

Correct answer: C. Queue

  1. Step 1: Breadth-First Search explores vertices in order of their distance from the source root node.
  2. Step 2: A First-In, First-Out (FIFO) Queue is essential to process neighboring nodes level by level in the exact order they are discovered.
Answer
Queue.
Why not the others: 'Stack' is used to implement Depth-First Search (DFS); 'Binary Search Tree' is an ordered tree structure; 'Disjoint Set' is used in Kruskal's minimum spanning tree algorithm.

Practise more Python Programming, Data Structures, Algorithms, Networks and Cybersecurity.

Free questions with an explanation for every one, and full timed Saudi Secondary School Certificate mock tests.

What data structure is… | Saudi Secondary School Certificate