All mock tests are FREE till 31 December — register to save your progress

Which of the following algorithms solves the single-source shortest paths ?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: D. Dijkstra’s algorithm

Explanation

Dijkstra solves single-source shortest paths. Prim builds MSTs; Floyd–Warshall and Johnson solve all-pairs.

More Data Structures and Algorithms questions