Dijkstra’s Algorithm will work for both negative and positive weights?

Category: QuestionsDijkstra’s Algorithm will work for both negative and positive weights?
Editor">Editor Staff asked 1 month ago

Dijkstra’s Algorithm will work for both negative and positive weights?
 
(a) True
 
(b) False
 
The origin of the question is Directed Graph in division Graph of Data Structures & Algorithms I
 
The question was asked in examination.

1 Answers
Editor">Editor Staff answered 1 month ago

Correct choice is (b) False
 
The explanation is: Dijkstra’s Algorithm assumes all weights to be non-negative.