128k views
2 votes
Which data structure is needed in an efficient implementation of Dijkstra's algorithm?

a) Stack
b) Queue
c) Priority queue
d) Binary search tree

User NadavS
by
8.2k points

1 Answer

6 votes

Final answer:

The efficient implementation of Dijkstra's algorithm requires a priority queue to effectively manage nodes based on the shortest path estimations.

Step-by-step explanation:

The data structure needed in an efficient implementation of Dijkstra's algorithm is a priority queue. A priority queue is a special type of queue where each element has a priority associated with it, and elements are served according to their priority, which correlates with the shortest path estimations in Dijkstra's algorithm.

This allows the algorithm to always process the next node with the smallest tentative distance, which is essential for its efficiency.

User AndyJost
by
7.5k points