1,097 views

1 Answer

1 1 vote
after analysis on this i found.

1) yes but they all infinite distance apart from source.

2)yes  as mentioned in algorithm while(Q!=phi) dijkstra's will always terminate

3)yes because for each vertex call extract min which is take O(log v) i.e total O(v log v) and in that for each edge we have relax all the adjacent edge which internally call decrease function call which take O(log v) i.e for each edge relaxation will be done only once so tatal for this O(e logv)

so total time O((v+e)logv) but in worst case there may be chance that no relaxation performed in that case time O(vlogv +e).

4)when no relaxation will performed in that case all vertices have cost infinity so simply extract one of them
Position:
Show:

Related questions

1 1 vote
1 1 answer
1.6k
1.6k views
Souvik33 asked Dec 19, 2022
1,570 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,744 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,414 views
When the graph contain negetive weight edges but no negetive weight cycle, in this case can dijkstra leads to incorrect result?