in Algorithms retagged by
1,549 views
1 vote
1 vote

I think answer should be Option(B).

Path:<s,y><y,x><x,t> = 7-3-2=2

in Algorithms retagged by
1.5k views

4 Comments

edited by

@Magma

can you check this

 

2
2
yeah correct

I did mistake ....that time
0
0
Thanks, Brother, you clear my doubts.
0
0

3 Answers

4 votes
4 votes
Best answer

According to dijkstra's algorithm, we will get shortest path as 6 which is a direct edge from s -> t.

There are only two direct edge from s  i.e  s -> t  with weight  6  and  s ->y  with weight 7 ,out of which 6 is minimum.

So, it will be selected in the first iteration itself.

Hence, Answer is 6

Note:- But manually if we calculate,we can get the shortest path as 2. So, we can consider this example to show that why dijkstra algorithm fails for the negative weighted edges.

selected by

3 Comments

You have to relax all the edges can you please check it once again.
@arjun sir can you help with this.
0
0
@Arpit

What you mean by relaxing the edges?
0
0
1 vote
1 vote
A(6) will be answer.
1 vote
1 vote
It will be 2 in Bellman Ford but correct in 6 THrough Dijkastra algorithm

Related questions

–1 vote
–1 vote
1 answer
4