Q. What is the main advantage of using a priority queue in Dijkstra's algorithm?
-
A.
It allows for faster insertion of nodes
-
B.
It ensures that the node with the smallest distance is processed next
-
C.
It reduces the space complexity
-
D.
It simplifies the implementation
Solution
Using a priority queue allows Dijkstra's algorithm to efficiently retrieve and process the node with the smallest tentative distance next.
Correct Answer:
B
— It ensures that the node with the smallest distance is processed next
Learn More →
Showing 1 to 1 of 1 (1 Pages)