Which of the following statement is false about Prim’s algorithm?
2020
Which of the following statement is false about Prim’s algorithm?
- A.
Initially the root's key is initialized to 0 and all other nodes to infinity
- B.
It may use binomial max heap to represent the priority queue
- C.
The complexity is O(E log V) using binary heap
- D.
The time complexity is O(E + V log V) using Fibonacci Heap
Attempted by 218 students.
Show answer & explanation
Correct answer: B
Concept: Prim's algorithm grows a Minimum Spanning Tree from a start vertex by repeatedly adding the cheapest edge that crosses from the tree to a vertex outside it (the cut property). To pick that cheapest crossing edge fast, every vertex keeps a key = the smallest edge weight connecting it to the current tree, and these keys are stored in a min-priority queue so that extract-min always returns the next vertex to attach.
Initialization: every vertex starts with key = infinity, then the start (root) vertex's key is set to 0 so it is the first one extracted. So the root's key is 0 while all other vertices begin at infinity and are lowered as cheaper edges are discovered.
Application — checking each statement against this method:
"binomial max heap for the priority queue" — Prim's needs the MINIMUM-weight vertex each step, which a min-priority queue (min-heap) provides. A max-heap returns the largest key, so it cannot drive Prim's; this claim does not hold.
"root key initialized to 0" — consistent with the initialization above: the start vertex's key is set to 0 (others are infinity), so this holds.
"O(E log V) using a binary heap" — with a binary heap each of the O(E) decrease-key and O(V) extract-min operations costs O(log V), giving O(E log V); this holds.
"O(E + V log V) using a Fibonacci heap" — a Fibonacci heap does decrease-key in O(1) amortized and extract-min in O(log V) amortized, giving O(E + V log V); this holds.
Cross-check: three statements match standard Prim's behaviour, so the single statement that is false about Prim's algorithm is the one claiming a binomial max heap can represent the priority queue.