Correct : G
Given:
Floyd-Warshall algorithm for all-pair shortest paths computation.
To find:
The algorithm design paradigm it is based on.
Solution:
Let me recall how the Floyd-Warshall algorithm works.
It computes the shortest path between all pairs of vertices in a directed, weighted graph.
Let d(k)[i][j] be the shortest path from vertex i to vertex j using only intermediate vertices from the set {1, 2, ..., k}.
The recurrence relation is:
d(k)[i][j] = min(d(k-1)[i][j], d(k-1)[i][k] + d(k-1)[k][j])
This shows that the problem exhibits optimal substructure and overlapping subproblems.
We build the solution bottom-up by iteratively increasing the set of allowed intermediate vertices from k = 1 to n.
Therefore, this algorithm directly uses the Dynamic Programming approach.
Answer: (C) Dynamic Programming paradigm.
Similar Questions
Total Unique Visitors