What is the main difference between Prim's and Kruskal's algorithms?

  • Kruskal's algorithm always selects the edge with the maximum weight.
  • Kruskal's algorithm starts with an arbitrary vertex and grows the minimum spanning tree from there.
  • Prim's algorithm builds the minimum spanning tree one vertex at a time, while Kruskal's algorithm builds it one edge at a time.
  • Prim's algorithm uses a greedy approach and always selects the vertex with the minimum key value.
The main difference between Prim's and Kruskal's algorithms is in their approach to building the minimum spanning tree. Prim's algorithm grows the tree one vertex at a time, always selecting the vertex with the minimum key value, while Kruskal's algorithm grows the tree one edge at a time by selecting the smallest available edge.
Add your answer
Loading...

Leave a comment

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