UGC NET Computer Science July 2018 - II Question 24
Question 24
24. Which of the following algorithms solves the single-source shortest paths ?
Options:
(1) Prim’s algorithm
(2) Floyd - Warshall algorithm
(3) Johnson’s algorithm
(4) Dijkstra’s algorithm
Answer : (4) Dijkstra’s algorithm
Explanation Question 24
Prim's algorithm = Min Cost spanning tree
Floys-Warshall algorithm = All pair shortest path
Johnson's algorithm = All pair shortest path
Dijkstra's algorithm = Single source shortest path
Bellman - Ford = Single source shortest path
The Floyd Warshall Algorithm is for solving the All Pairs Shortest Path problem. The problem is to find shortest distances between every pair of vertices in a given edge weighted directed Graph.
Dijkstra’s Algorithm allows you to calculate the shortest path between one node of your choosing and every other node in a graph. Dijkstra’s algorithm solves the single-source shortest paths.
The Floyd Warshall Algorithm is for solving the All Pairs Shortest Path problem. The problem is to find shortest distances between every pair of vertices in a given edge weighted directed Graph.
Dijkstra’s Algorithm allows you to calculate the shortest path between one node of your choosing and every other node in a graph. Dijkstra’s algorithm solves the single-source shortest paths.
So, Option (4) is correct answer.