1.

Which of the following is false about Prim’s algorithm?(a) It is a greedy algorithm(b) It constructs MST by selecting edges in increasing order of their weights(c) It never accepts cycles in the MST(d) It can be implemented using the Fibonacci heapThe question was posed to me in an interview for internship.I want to ask this question from Minimum Spanning Tree in chapter Minimum Spanning Tree of Data Structures & Algorithms II

Answer»

Correct choice is (b) It constructs MST by SELECTING edges in INCREASING order of their weights

For explanation: Prim’s algorithm can be implemented using Fibonacci heap and it NEVER accepts cycles. And Prim’s algorithm FOLLOWS greedy approach. Prim’s algorithms span from one vertex to another.



Discussion

No Comment Found

Related InterviewSolutions