edited by
1,255 views
0 votes
0 votes

Which of the following statements is/are true?
S1: Dijkstra’s algorithm is not affected by negative edge weight cycles in the graph and gives correct shortest path.
S2: Bellman ford algorithm finds all negative edge weight cycles present in the graph.

a) Only S2

b) Only S1

c) Both S1 and S2

d) Neither S1 and nor S2

edited by

2 Answers

1 votes
1 votes
Both are wrong . dijisktra algorithm i not affected by negative weights till there is a negative weight cycle.

bellman ford use the logic that in a graph .the shortest path contain atmost ( n-1) edges. it does not find all the cycles . and i think finding all the cycles in the graph will be exponential time because in the worst case every vertex will have a cycle . and we may have to look n vertices ( n*n)
0 votes
0 votes
ans is d

in case of graph having -ve edge cycles shortest path to all the vertices .

that lies in the -ve edge cycles and reachable through the -ve edge cycles are not determined by any algorithm

Related questions

0 votes
0 votes
0 answers
2
CHïntän ÞäTël asked Dec 25, 2018
368 views
According To Me Answer Should Be 6… Anyone Please Try Once!!! Given Is 5 With No Explaination !!!!like 11-12-12 then for second square 4 times 13 so c(4,2) any two of t...
2 votes
2 votes
1 answer
4