As per my understanding, I have calculated time complexity of Dijkstra Algorithm as big-O notation using adjacency list given below. It didn\'t come out as it was supposed t
Adding a more detailed explanation as I understood it just in case:
O(for each vertex using min heap: for each edge linearly: push vertices to min heap that edge points to)V = number of verticesO(V * (pop vertex from min heap + find unvisited vertices in edges * push them to min heap))E = number of edges on each vertexO(V * (pop vertex from min heap + E * push unvisited vertices to min heap)). Note, that we can push the same node multiple times here before we get to "visit" it.O(V * (log(heap size) + E * log(heap size)))O(V * ((E + 1) * log(heap size)))O(V * (E * log(heap size)))E = V because each vertex can reference all other verticesO(V * (V * log(heap size)))O(V^2 * log(heap size))V^2 because we push to it every time we want to update a distance and can have up to V comparisons for each vertex. E.g. for the last vertex, 1st vertex has distance 10, 2nd has 9, 3rd has 8, etc, so, we push each time to updateO(V^2 * log(V^2))O(V^2 * 2 * log(V))O(V^2 * log(V))V^2 is also a total number of edges, so if we let E = V^2 (as in the official naming), we will get the O(E * log(V))