Which algorithm, Prim's or Kruskal's, typically performs better on dense graphs?

  • Both perform equally
  • Depends on graph characteristics
  • Kruskal's
  • Prim's
Kruskal's algorithm typically performs better on dense graphs. This is because Kruskal's algorithm uses a sorting-based approach to select edges, making it more efficient when there are a large number of edges in the graph. Prim's algorithm, on the other hand, involves repeated key updates in dense graphs, leading to a higher time complexity.
Add your answer
Loading...

Leave a comment

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