Practice free →
HomeGATE CSEcomputerscienceAlgorithms › Dijkstra's algorithm using a binary min-heap run…

Dijkstra's algorithm using a binary min-heap runs in

AO(V²) regardless of E
BO(E log V) using a binary min-heap
CO(V + E), like BFS
DO(E + V log V), using a Fibonacci heap
Answer & Solution
Correct answer: B. O(E log V) using a binary min-heap
Binary heap: V Extract-Min calls at O(log V) plus up to E Decrease-Key calls at O(log V). Total O((V + E) log V) which simplifies to O(E log V) for connected graphs. O(V²) is the naive-array version on dense graphs; O(V + E) is BFS; O(E + V log V) is the Fibonacci-heap version (better, but harder to implement).
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions