Floyd-Warshall algorithm utilizes __________ to solve the all-pairs shortest paths problem on a directed graph in __________ time.
Dynamic programming, \(\theta(V^{3})\)
Floyd-Warshall builds \(d^{(k)}_{ij} = \min(d^{(k-1)}_{ij},\ d^{(k-1)}_{ik} + d^{(k-1)}_{kj})\), reusing solutions of smaller subproblems, which is dynamic programming.
It runs three nested loops over k, i and j, each over V vertices, so the time is \(\theta(V^{3})\).
It is not greedy, and no logarithmic factor appears in its running time.
Hence, Dynamic programming, \(\theta(V^{3})\).
An all-pairs shortest-paths problem is efficiently solved using :
Match List - I with List - II.
| List - I | List - II |
|---|---|
| (A) Dijkstra’s Algorithms | (I) Find the shortest path between all pairs of vertices in a graph with positive or negative edge weights. |
| (B) Floyd-Warshall Algorithms | (II) Finds the shortest path in a weighted graph with non-negative edge weights. |
| (C) Bellman-frod Algorithms | (III) Grows a spanning tree by repeatedly adding the smallest edge to a neighboring vertex. |
| (D) Prim’s Algorithms | (IV) Finds the shortest paths from a single source in a directed graph with negative edge weights. |
Choose the correct answer from the options given below :
An all-pairs shortest-paths problem is efficiently solved using :
Match List - I with List - II.
| List - I | List - II |
|---|---|
| (A) Dijkstra’s Algorithms | (I) Find the shortest path between all pairs of vertices in a graph with positive or negative edge weights. |
| (B) Floyd-Warshall Algorithms | (II) Finds the shortest path in a weighted graph with non-negative edge weights. |
| (C) Bellman-frod Algorithms | (III) Grows a spanning tree by repeatedly adding the smallest edge to a neighboring vertex. |
| (D) Prim’s Algorithms | (IV) Finds the shortest paths from a single source in a directed graph with negative edge weights. |
Choose the correct answer from the options given below :