Greedy Algorithms | Set 5 (Prim’s Minimum Spanning Tree (MST)) | GeeksforGeeks Like Kruskal’s algorithm...

Please Visit: http://ift.tt/1ajReyV



Greedy Algorithms | Set 5 (Prim’s Minimum Spanning Tree (MST)) | GeeksforGeeks

Like Kruskal’s algorithm, Prim’s algorithm is also a Greedy algorithm (Link->http://ift.tt/1stB6cV) . 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.

http://ift.tt/1stB4l5

http://ift.tt/1iRgPnU



Greedy Algorithms | Set 5 (Prim’s Minimum Spanning Tree (MST)) | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1stB6cX

via LifeLong Community

No comments:

Post a Comment