Multiple choice

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

  1. Greedy

  2. Depth-first search

  3. Dyanamic programming

  4. Divide and conquer

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The Floyd-Warshall algorithm for all pairs shortest path uses dynamic programming. It builds solutions incrementally by considering intermediate vertices, storing results in a 2D table to avoid redundant calculations.