Which of the following algorithms solves the all-pairs shortest path problem?

2018

Which of the following algorithms solves the all-pairs shortest path problem?

Answer: B. Floyd’s algorithmThe all-pairs shortest path problem is solved by Floyd’s algorithm (Floyd–Warshall algorithm) , which computes shortest paths between every pair of vertices…

  1. A.

    Dijkstra’s algorithm

  2. B.

    Floyd’s algorithm

  3. C.

    Prim’s algorithm

  4. D.

    Warshall’s algorithm

Attempted by 505 students.

Show answer & explanation

Correct answer: B

The all-pairs shortest path problem is solved by Floyd’s algorithm (Floyd–Warshall algorithm) , which computes shortest paths between every pair of vertices using dynamic programming. Dijkstra’s algorithm → single-source shortest path

Prim’s algorithm → minimum spanning tree

Warshall’s algorithm → transitive closure

Explore the full course: Up Lt Grade Assistant Teacher 2025

Loading lesson…