911 views
0 0 votes

2 Answers

0 0 votes

Dijkstra’s Algorithm Execution Table (Source = a)

StepSelected Nodeabcdefgh
Init0
1a01
2d031311
3c031311
4e03136
5f03136118
6i03136119
7g03136119

Final Output (as per Dijkstra)

VertexShortest Distance
a0
b
c3
d1
e3
f6
g11
h9

⚠️ Important Note

  • The real shortest path to h is 7,

  • But Dijkstra gives 9 because it fails in presence of negative edge (g → h = –4).


FINAL ANSWER IS 9

Position:
Show:

Related questions

1 1 vote
1 1 answer
1.6k
1.6k views
Souvik33 asked Dec 19, 2022
1,554 views
If a -ve weight cycle is reachable from source, the Dijkstra's algorithm gets into an infinite loop TRUEFALSE
6 6 votes
1 answers 1 answer
3.7k
3.7k views
vaishali jhalani asked Nov 5, 2016
3,704 views
What is the time complexity of Dijkstra’s algorithm if it is implemented using AVL Tree instead of Priority Queue over a graph G = (V, E)?
1 1 vote
1 answers 1 answer
1.4k
1.4k views
vaishali jhalani asked Nov 4, 2016
1,395 views
When the graph contain negetive weight edges but no negetive weight cycle, in this case can dijkstra leads to incorrect result?