ISRO Scientist/Engineer CSE 2017Algorithms › Design Techniques and Graph Algorithms
ISRO Scientist/Engineer CSE 2017 PYQ: Which of the following data structure is useful in traversing a given graph by breadth first search?
Which of the following data structure is useful in traversing a given graph by breadth first search?
- AStack
- BQueueCorrect answer
- CList
- DNone of the above
Answer
(B) Queue
Approach
Recall the operational mechanism of breadth-first search (BFS): it explores a graph level by level, visiting all neighbors of a node before moving deeper. The data structure that naturally supports this first-in-first-out (FIFO) exploration order is the queue.
Reviewed by ISRO IQ Editorial Team.