Prim's algorithm typically performs better on graphs with _______ edges, while Kruskal's algorithm is more efficient on graphs with _______ edges.

  • Acyclic, Cyclic
  • Cyclic, Acyclic
  • Dense, Sparse
  • Sparse, Dense
Prim's algorithm typically performs better on graphs with sparse edges, where only a small number of edges exist. In contrast, Kruskal's algorithm is more efficient on graphs with dense edges, where a large number of edges are present. This is because the priority queue operations in Prim's algorithm are generally faster on sparse graphs.
Add your answer
Loading...

Leave a comment

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