Practice free →
HomeGATE CSEcomputerscienceAlgorithms › Prim's algorithm with a Fibonacci heap runs in

Prim's algorithm with a Fibonacci heap runs in

AO(V²) on any graph
BO(E log E) like Kruskal exactly
CO(E + V log V)
DO(V³) on dense graphs
Answer & Solution
Correct answer: C. O(E + V log V)
Fibonacci heap gives O(1) amortised Decrease-Key and O(log V) Extract-Min. Total: V Extract-Mins + E Decrease-Keys = O(V log V + E) = O(E + V log V). On dense graphs (E = Θ(V²)) this is O(V²), beating Kruskal's O(E log V) = O(V² log V). With a binary heap, Prim is O(E log V), matching Kruskal.
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions