GATE / CS ARCHIVE

GATE CSE 1998 / QUESTION 1.21

All-pairs shortest paths

Algorithms · Dynamic Programming · Full GATE CSE 1998 paper

GATE 1998, Q1.21 1 mark · MCQ
Report issue

Dynamic Programming

Question 1.21, GATE 1998: Which technique underlies the standard all-pairs shortest-path algorithm: dynamic programming, backtracking, greedy, divide-and-conquer?
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Floyd–Warshall defines Dk (i, j) as the best path using only the first k vertices as intermediates. It either avoids k or passes through it, yielding Dk (i, j)=min (Dk−1(i, j), Dk−1(i, k)+Dk−1(k, j)). Reusing these overlapping subproblem values is dynamic programming, A. The answer refers to this standard all-pairs algorithm; other algorithms can solve restricted graph classes, so the task name alone is not a proof that every possible implementation uses the same paradigm.

Original paper, page 2