To implement Dijkstra’s shortest path algorithm on unweighted graphs so that it runs in linear time, the data structure to be used is:
Answer is A: Queue
we can find single source shortest path in unweighted graph by using Breadth first search (BFS) algorithm which using "Queue" data structure , which time $O(m+n)$ (i.e. linear with respect to the number of vertices and edges. )
for this ques why cant we use stack becz using BFS and DFS both we can get complexity of linear time . So why we are only biasing towards BFS .Pls explain???
Ans Can Also be (C) Heap.
Min Heap Creation Time O(V)
Deletion From Heap Constant Time(Because All elements are Equal)
Visiting Adj. List time O(E)
So total is O(V+E)