GATE | Sudo GATE 2020 Mock III (24 January 2019) | Question 27

Consider the following statements:

I. Given a graph G = (V, E) with distinct positive edge weights, the Bellman-Ford algorithm and Dijkstra’s algorithm can produce different shortest-path trees despite always producing the same shortest-path weights.

II. Given a graph G = (V, E) with distinct positive edge weights, the Kruskal’s algorithm and Prim’s algorithm can produce different spanning trees despite always producing the same minimum weights.

Which of the following option is correct ?
(A) Only statement I is correct.
(B) Only statement II is correct.
(C) Both statements I and II are correct.
(D) Neither statement I nor II is correct.


Answer: (A)

Explanation: Statement (I) is correct.
Both algorithms are guaranteed to produce the same shortestpath weight, but if there are multiple shortest paths, Dijkstra’s will choose the shortest path according to the greedy strategy, and Bellman-Ford will choose the shortest path depending on the order of relaxations, and the two shortest path trees may be different.

But statement (II) is not correct as minimum spanning is always unique in a graph G = (V, E) with distinct positive edge weights.

Option (A) is correct.


Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.