Skip to content
Related Articles

Related Articles

Algorithms | Graph Shortest Paths | Question 15
  • Last Updated : 23 Oct, 2013

Is the following statement valid?.

Given a graph where all edges have positive weights, the shortest paths produced by Dijsktra and Bellman Ford algorithm may be different but path weight would always be same.
(A) True
(B) False


Answer: (A)

Explanation: Dijkstra and Bellman-Ford both work fine for a graph with all positive weights, but they are different algorithms and may pick different edges for shortest paths.

Quiz of this Question

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :