Which one of the following algorithm design techniques is used in finding all…

2008

Which one of the following algorithm design techniques is used in finding all pairs of shortest distances in a graph?

  1. A.

    Dynamic programming

  2. B.

    Backtracking

  3. C.

    Greedy

  4. D.

    Divide and Conquer

Attempted by 246 students.

Show answer & explanation

Correct answer: A

The Floyd-Warshall algorithm is the standard approach for finding all-pairs shortest paths in a weighted graph. It operates using dynamic programming by iteratively improving path estimates through intermediate vertices. Unlike greedy algorithms (like Dijkstra) which typically handle single-source paths, or backtracking methods used for constraint satisfaction, dynamic programming is the core technique here.

Explore the full course: Isro