InterviewSolution
Saved Bookmarks
| 1. |
What happens when the value of k is 0 in the Floyd Warshall Algorithm?(a) 1 intermediate vertex(b) 0 intermediate vertex(c) N intermediate vertices(d) N-1 intermediate verticesThis question was addressed to me during an online exam.My query is from Shortest Path topic in division Shortest Path of Data Structures & Algorithms II |
|
Answer» RIGHT CHOICE is (b) 0 intermediate vertex Easiest explanation - When k=0, a path from vertex i to vertex j has no intermediate vertices at all. Such a path has at most one edge and HENCE dij(0) = wij. |
|