Skip to content
Related Articles

Related Articles

Improve Article

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

  • Last Updated : 21 Jan, 2020

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

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :