• retagged by
4,666 views
1 1 vote

I think answer should be Option(B).

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

3 Answers

Best answer
4 4 votes

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
Position:
Show:

Related questions

1 1 vote
1 answers 1 answer
1.6k
1.6k views
0 0 votes
2 answers 2 answers
3.9k
3.9k views
radha gogia asked Jul 5, 2015
3,937 views
Following statement is true or false?If we make following changes to Dijkstra, then it can be used to find the longest simple path, assume that the graph is acyclic.1) In...
2 2 votes
1 1 answer
1.1k
1.1k views
Sahil Gupta asked Dec 16, 2014
1,114 views
if Dijkstra shorest path algorithm takes 8 second for a graph of 1000 nodes then approximatly how much time would it take for a graph of 1000000 nodes.a) 8000000 sec.b) 8...
–1 –1 vote
1 1 answer
2.0k
2.0k views