Algorithms | Graph Traversals | Question 12

What are the appropriate data structures for following algorithms?

1) Breadth First Search                           
2) Depth First Search                            
3) Prim's Minimum Spanning Tree                 
4) Kruskal' Minimum Spanning Tree                

(A)

1) Stack
2) Queue
3) Priority Queue
4) Union Find

(B)



1) Queue
2) Stack
3) Priority Queue
4) Union Find

(C)

1) Stack
2) Queue
3) Union Find
4) Priority Queue 

(D)

1) Priority Queue
2) Queue
3) Stack
4) Union Find


Answer: (B)

Explanation: 1) Breadth First Search uses Queue
2) Depth First Search uses Stack
3) Prim’s Minimum Spanning Tree uses Priority Queue.
4) Kruskal’ Minimum Spanning Tree uses Union Find.

Quiz of this Question



My Personal Notes arrow_drop_up