retagged by
311 views
0 votes
0 votes
Which of the following statements is/are correct?

Consider 'n' as the number of nodes in graph.

A.In an unweighted, undirected connected graph, Dijkstra’s algorithm can be used to compute shortest path from node S to all the other vertices.

B.Bellman’s ford algorithm always detects a negative weighted cycles if it exists.

C.The time complexity of Dijkstra’s algorithm using unsorted array for the greedy selection of vertices and adjacency matrix is theta(n^2)

D.The time complexity of Bellman’s ford algorithm is always theta(n^3)
retagged by

1 Answer

0 votes
0 votes

A.  Wrong  .  because for Dijkstra’s we need a edge weight .    or to find single source shortest path of  unweighted BFS is used.

 

B.   Wrong .  because Bellman’s ford algorithm can detect the negative edge weight cycle reachable from source

  

 

C .  right 

        time complexity of Dijkstra’s using unsorted array and with adjacency matrix of

        (n vertices and e edges) =  Ɵ(n2)  + Ɵ(n2)  + Ɵ(e) 

                                               =  Ɵ(n2

D    right :   because in all case time complexity of   Bellman’s ford algorithm  is   Bellman’s ford Ɵ(n3)

 

 

 ans : C , D

Related questions

354
views
1 answers
0 votes
1.4k
views
2 answers
0 votes
eyeamgj asked Aug 3, 2018
1,408 views
doubt on complexity of bellman ford how it can be O(V2E)
1.3k
views
2 answers
0 votes
radha gogia asked Jul 5, 2015
1,334 views
A) Do following for every vertex u in topological order.………..Do following for every adjacent vertex v of u………………if (dist[v] dist[u] + weight(u, v))…�...
288
views
0 answers
0 votes
Ray Tomlinson asked Aug 9, 2023
288 views
what they want to tell and it is true or false?