2

Prim's Algorithm for MST(with Code Walkthrough)

 1 year ago
source link: https://www.geeksforgeeks.org/videos/prims-algorithm-for-mstwith-code-walkthrough/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Prim's Algorithm for MST(with Code Walkthrough)

Prim's Algorithm for MST(with Code Walkthrough)
  • 28/06/2022

We have discussed Kruskal’s algorithm for Minimum Spanning Tree. Like Kruskal’s algorithm, Prim’s algorithm is also a Greedy algorithm. It starts with an empty spanning tree. The idea is to maintain two sets of vertices. The first set contains the vertices already included in the MST, the other set contains the vertices not yet included. At every step, it considers all the edges that connect the two sets, and picks the minimum weight edge from these edges. After picking the edge, it moves the other endpoint of the edge to the set containing MST.

Prim's Algorithm for MST(with Code Walkthrough : https://www.geeksforgeeks.org/prims-minimum-spanning-tree-mst-greedy-algo-5/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK