1.

The data structure required for Breadth First Traversal on a graph is?(a) Stack(b) Array(c) Queue(d) TreeMy doubt is from Queue Operations topic in section Abstract Data Types of Data Structures & Algorithms IThe question was posed to me in quiz.

Answer»

Right CHOICE is (c) Queue

Best explanation: In Breadth First Search TRAVERSAL, BFS, starting vertex is first TAKEN and adjacent vertices which are UNVISITED are also taken. Again, the first vertex which was added as an unvisited adjacent vertex list will be considered to add further unvisited vertices of the graph. To get the first unvisited vertex we need to follows First In First Out PRINCIPLE. Queue uses FIFO principle.



Discussion

No Comment Found

Related InterviewSolutions