<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>programes | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/programes/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Thu, 11 Mar 2010 16:56:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>C++ programs to implement the Kruskal’s algorithm to generate a minimum cost spanning tree</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-programs-to-implement-the-kruskal%e2%80%99s-algorithm-to-generate-a-minimum-cost-spanning-tree/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-programs-to-implement-the-kruskal%e2%80%99s-algorithm-to-generate-a-minimum-cost-spanning-tree/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Thu, 11 Mar 2010 16:56:57 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[spanning tree]]></category>
		<category><![CDATA[Kruskal’s algorithm]]></category>
		<category><![CDATA[minimum cost]]></category>
		<category><![CDATA[programes]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1024</guid>

					<description><![CDATA[<p>/* Write C++ programs to implement the Kruskal’s algorithm to generate a minimum cost spanning tree */ #include #include #include using namespace std; int cost[10][10],i,j,k,n,m,c,visit,visited[10],l,v,count,count1,vst,p; main() { int dup1,dup2; cout n; cout m; cout >j >>c; cost[i][j]=c; cost[j][i]=c; } for(i=1;i</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-programs-to-implement-the-kruskal%e2%80%99s-algorithm-to-generate-a-minimum-cost-spanning-tree/">C++ programs to implement the Kruskal’s algorithm to generate a minimum cost spanning tree</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>/* Write C++ programs to implement the Kruskal’s algorithm to generate a minimum cost spanning tree */</p>
<pre lang="cpp">
#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
int cost[10][10],i,j,k,n,m,c,visit,visited[10],l,v,count,count1,vst,p;

main()
{
int dup1,dup2;
cout<<"enter no of vertices";
cin >> n;
cout <<"enter no of edges";
cin >>m;
cout <<"EDGE Cost";
for(k=1;k<=m;k++)
{
cin >>i >>j >>c;
cost[i][j]=c;
cost[j][i]=c;
}
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(cost[i][j]==0)
cost[i][j]=31999;
visit=1;
while(visit<n)
{
v=31999;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(cost[i][j]!=31999 &#038;&#038; cost[i][j]<v  &#038;&#038; cost[i][j]!=-1 )
{
int count =0;
for(p=1;p<=n;p++)
{
if(visited[p]==i || visited[p]==j)
count++;
}
if(count >= 2)
{
for(p=1;p<=n;p++)
if(cost[i][p]!=31999 &#038;&#038; p!=j)
dup1=p;
for(p=1;p<=n;p++)
if(cost[j][p]!=31999 &#038;&#038; p!=i)
dup2=p;

if(cost[dup1][dup2]==-1)
continue;
}
l=i;
k=j;
v=cost[i][j];
}
cout <<"edge from " <<l <<"-->"<<k;
cost[l][k]=-1;
cost[k][l]=-1;
visit++;
int count=0;
count1=0;
for(i=1;i<=n;i++)
{
if(visited[i]==l)
count++;
if(visited[i]==k)
count1++;
} 
if(count==0)
visited[++vst]=l;
if(count1==0)
visited[++vst]=k;
}
}
</pre>
<p><strong>OUTPUT</strong></p>
<p>enter no of vertices4<br />
enter no of edges4<br />
EDGE Cost<br />
1 2 1<br />
2 3 2<br />
3 4 3<br />
1 3 3</p>
<p>edge from 1-->2edge from 2-->3edge from 1-->3</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-programs-to-implement-the-kruskal%e2%80%99s-algorithm-to-generate-a-minimum-cost-spanning-tree/">C++ programs to implement the Kruskal’s algorithm to generate a minimum cost spanning tree</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-programs-to-implement-the-kruskal%e2%80%99s-algorithm-to-generate-a-minimum-cost-spanning-tree/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
