Given the following algorithm from Cormen book:
DIJKSTRA(G,w,s)
1. INITIALIZE-SINGLE-SOURCE(G,s)
2. S <-- {0}
3. Q <-- V[G]
4. while (Q != {0})
5. do u <-- extract-min(Q)
6. s <-- s U {u}
7. for each vertex v at Adj(u)
8. do RELAX(u,v,w)
RELAX (u,v,w)
if d[v] > d[u] + w(u,v)
then d[v] <-- d[u] + w(u,v)
pie(v) <--- u
Our prof told us that if we use Binary Heap, the Relax operation takes O(log|V|), and therefore the loop at line 7-8 takes O(|E|*log|V|).. (If we use linear queue then the relax takes O(1)). Ive been searching google for a while and just cant find a good explanation for that. why does the relax operation take O(log|V|) when we use binary heap? Would love to get some help. thanks.