Its better to wait for a productive programmer to become available than it is to wait for the first available programmer to become productive. Steve McConnell

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.