retagged by
2,507 views
1 1 vote
Let G(V,E) an undirected graph with positive edge weights . Dijkstras single source algorithm can be implemented using the sorted linked list data structure and adjacency list . What is the time complexity?

a) O(E|V|)

b)O(|V|^3)

c)O(|V|log|v|)

d)O((|E|+|V|)log|V|)

1 Answer

5 5 votes

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

for sorted linked list extract-min would take O(1) and Relax operation would take O(V).

Time complexity=O(V*time for one extract min + E* time for one relax operation)

                       =O(V*O(1) + E*O(V))

                       =O(EV)

This complexity is for sparse graph if dense graph then replace E by V^2

Option (A) is correct

Position:
Show:

Related questions

1 1 vote
1 1 answer
117
117 views
GO Classes asked Aug 29
117 views
Consider Dijkstra's algorithm on a graph having $V$ vertices and $E$ edges.Suppose an indexed priority queue is not used.Instead, the tentative distances are stored only ...
0 0 votes
1 1 answer
114
114 views
GO Classes asked Aug 26
114 views
Let $G=(V,E)$ be a directed graph with positive edge weights.Given vertices $s,w,t$ we want the length of the shortest path from $s$ to $t$ that must pass through $w$.Con...
1 1 vote
1 1 answer
133
133 views
GO Classes asked Aug 26
133 views
Let $G$ be a directed graph with nonnegative edge weights.Run Dijkstra's algorithm from source $s$. After the algorithm terminates, use the $\text{prev}$ pointers to cons...