The space complexity of Prim's algorithm is _______ compared to Kruskal's algorithm due to its _______ approach.

  • Greater, Dynamic Programming
  • Greater, Greedy
  • Lesser, Dynamic Programming
  • Lesser, Greedy
The space complexity of Prim's algorithm is generally lesser compared to Kruskal's algorithm due to its greedy approach. Prim's algorithm maintains a priority queue of vertices, requiring space proportional to the number of vertices, while Kruskal's algorithm needs space for storing the entire set of edges.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *