Imagine you are working on a project where the graph representing connections between cities is sparse. Discuss which algorithm, Prim's or Kruskal's, would be more suitable for finding the minimum spanning tree in this scenario.

  • Breadth-First Search
  • Depth-First Search
  • Kruskal's
  • Prim's
Kruskal's algorithm is more suitable for finding the minimum spanning tree in a sparse graph representing connections between cities. Kruskal's algorithm excels in sparse graphs due to its edge-based approach, making it efficient for scenarios where the graph has relatively fewer connections.
Add your answer
Loading...

Leave a comment

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