<?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>dynamic programming | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/dynamic-programming/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 17:36:22 +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++ program to implement dynamic programming algorithm to solve the all pairs shortest path problem</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-dynamic-programming-algorithm-to-solve-the-all-pairs-shortest-path-problem/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-dynamic-programming-algorithm-to-solve-the-all-pairs-shortest-path-problem/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Thu, 11 Mar 2010 17:36:22 +0000</pubDate>
				<category><![CDATA[Data structure]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[dynamic programming]]></category>
		<category><![CDATA[shortest path problem]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1040</guid>

					<description><![CDATA[<p>/* Write a C++ program to implement dynamic programming algorithm to solve the all pairs shortest path problem */ #include #include using namespace std; int min(int a,int b); int cost[10][10],a[10][10],i,j,k,c; main() { int n,m; cout n; cout m; cout>j>>c; a[i][j]=cost[i][j]=c; } for(i=1;i</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-dynamic-programming-algorithm-to-solve-the-all-pairs-shortest-path-problem/">C++ program to implement dynamic programming algorithm to solve the all pairs shortest path problem</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>/* Write a C++ program to implement dynamic programming algorithm to solve the all pairs shortest path problem */</p>
<pre lang="cpp">
#include<iostream>
#include<conio.h>
using namespace std;
int min(int a,int b);
int cost[10][10],a[10][10],i,j,k,c;

main()
{
  int n,m;
  cout <<"enter no of vertices";
  cin >> n;
  cout <<"enter no od edges";
  cin >> m;
  cout<<"enter the\nEDGE Cost\n";
for(k=1;k<=m;k++)
{
cin>>i>>j>>c;
a[i][j]=cost[i][j]=c;
}
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
{
if(a[i][j]== 0 &#038;&#038; i !=j)
a[i][j]=31999;
}
for(k=1;k<=n;k++)
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
a[i][j]=min(a[i][j],a[i][k]+a[k][j]);
cout <<"Resultant adj matrix\n";
for(i=1;i<=n;i++)
{
for( j=1;j<=n;j++)
  {
  if(a[i][j] !=31999)
  cout << a[i][j] <<" ";
  }
cout <<"\n";
}
getch();
}
int min(int a,int b)
{
if(a<b)
return a;
else
return b;
}
</pre>
<p><strong>OUTPUT</strong></p>
<p>enter no of vertices3<br />
enter no od edges5<br />
enter the<br />
EDGE Cost<br />
1 2 4<br />
2 1 6<br />
1 3 11<br />
3 1 3<br />
2 3 2<br />
Resultant adj matrix<br />
0 4 6<br />
5 0 2<br />
3 7 0</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-dynamic-programming-algorithm-to-solve-the-all-pairs-shortest-path-problem/">C++ program to implement dynamic programming algorithm to solve the all pairs shortest path problem</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-program-to-implement-dynamic-programming-algorithm-to-solve-the-all-pairs-shortest-path-problem/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
	</channel>
</rss>
