# Prim's Algorithm

Email
 Submitted on: 1/9/2015 11:30:00 PM By: Adri Jovin (from psc cd) Level: Intermediate User Rating: By 2 Users Compatibility: C++ (general) Views: 2823

Implementataion of Prim's Algorithm

code:
Can't Copy and Paste this?
 ``` //************************************** // Name: Prim's Algorithm // Description:Implementataion of Prim's Algorithm // By: Adri Jovin (from psc cd) //************************************** #include #include class prim { int a,b,u,v,i,j,n,noofedge; int visited[10],min,minicost,cost[10][10]; public: prim() { noofedge=1; minicost=0; } void read(); void prims(int cost[][10],int n); }; void prim::read() { cout<<"\nEnter the number of vertices:\n"; cin>>n; cout<<"\nEnter the adjacency matrix:\n"; for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { cin>>cost[i][j]; if(cost[i][j]==0) cost[i][j]=999; } } prims(cost,n); } void prim::prims(int cost[][10],int n) { for(i=2;i<=n;i++) visited[i]=0; cout<<"\nEdges in the spanning tree are: \n"; visited[1]=1; while(noofedge

Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)