Greedy Algorithms | Set 2 (Kruskal’s Minimum Spanning Tree Algorithm) | GeeksforGeeks 1. Sort all the...

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



Greedy Algorithms | Set 2 (Kruskal’s Minimum Spanning Tree Algorithm) | GeeksforGeeks



1. Sort all the edges in non-decreasing order of their weight.

2. Pick the smallest edge. Check if it forms a cycle with the spanning tree

formed so far. If cycle is not formed, include this edge. Else, discard it.

3. Repeat step#2 until there are (V-1) edges in the spanning tree.

The step#2 uses Union-Find algorithm (Link->http://ift.tt/UbhbiO) to detect cycle.

http://ift.tt/UkFhsm

http://ift.tt/Ubhev1



Greedy Algorithms | Set 2 (Kruskal’s Minimum Spanning Tree Algorithm) | GeeksforGeeks







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

via LifeLong Community

No comments:

Post a Comment