If you think your management doesn't know what it's doing or that your organization turns out low-quality software crap that embarrasses you, then leave. Edward Yourdon

Prime Kruskal algorithm

Language Java | Level Intermediate | Category Algorithms | August 5, 2015 7:56 am


Algorithm Problem Description

Prime Algorithm helps to find minimum-spanning-tree. Prims algorithm is useful when a graph with lots of edges. It is significantly faster in the limit when dense graph with many more edges than vertices. Kruskal performs better in sparse graphs and it uses simpler data structures.

Write program to implement prim's algorithm

Output

          	        
          	        

Minimum Spanning Tree is: 
1 -- 0
2 -- 1
3 -- 4
4 -- 5
5 -- 2
6 -- 5
7 -- 6
8 -- 2
Minimum spanning tree Cost is: 40

          	        
          	        				    


Comments



Please login to add comments.