• edited by
3,891 views
4 4 votes

Let $G(V,E)$ an undirected graph with positive edge weights. Dijkstra single source shortest path algorithm can be implemented using sorted linked list data structure. What will be time complexity?

  1. $O(|V|^2)$
  2. $O(|V|^3)$
  3. $O(|V|log|V|)$

1 Answer

Best answer
12 12 votes
The answer should be option b.

The basic operations of Dijkstra's algorithm are extract-min and Relax(decrease key).

Now for sorted linked list extract-min would take $O(1)$ and Relax operation would take $O(V)$. And as we know the Relax operation will be applied on every edge so upper bound would become $O(VE)$.

Now in worst case $E=|V|^2$ , so time complexity $= O(V^2.V) =O(|V|^3).$
• edited by
Position:
Show:

Related questions

0 0 votes
1 1 answer
470
470 views
Neeraj_patel asked Nov 14, 2024
470 views
What is the Time Complexity of the Dijkstra when it is using Adjacency list + Array (sorted or unsorted ) ? If it is O( V^2 + E ) then ,According to the General form of A...
0 0 votes
0 0 answers
562
562 views
Elaf asked Jan 22, 2023
562 views
0 0 votes
0 0 answers
816
816 views
gate20232 asked Jan 18, 2023
816 views
2 2 votes
1 answers 1 answer
1.4k
1.4k views
srestha asked May 18, 2019
1,422 views
Which of the following procedure results same output as Dijkstra’s Algo. on unweighted graph on $'n'$ verices?$A)$ BFS $B)$ DFS $C)$Kruskal $D)$ PrimsAs far I know Di...