Professional Documents
Culture Documents
"# $%%
&'
(
) *+
+
, !"#-+
, !"#-+
, !"#-+
.%+
. +
*. +
5 & 6.73%7'
(
& ..7%7'
(
*. +
*88+
88+
9
(
5 & ..7$7 11 6.:'
(
88+
*. +
*88+
88+
9
& ..:'
(
*.7%7+
*88+
9
.%+
9
9
*.73%7+
&/3 /'+
&/3 4 /) '+
. +
*. +
(
5 & ..7$7 11 6.:'
(
88+
*. +
*88+
88+
9
& ..:'
(
88+
9
.%+
9
9
*.73%7+
&/3 /'+
&/3 4 3 /) '+
%+
9
&%0 1 $0 2'
$%$%$$$$$$
$%$%$$$$$%$
$%$%$$$$$$
! " # $ % & % % (
& 5 ; ; 2 < 2'
!"# $%%
&'
(
, !"#-) , !"#-) , !"#-+
) *+
+
&/ 3 /'+
&/4 /) '+
. +
*. +
5 & 6.73%7'
(
& ..7 7'
(
*. +
88+
*88+
& ..7 7'
(
*. +
88+
*88+
& ..7 7'
(
*. +
88+
*88+
&*88'.7 7+
&*88'.7 7+
&*88'.7 7+
9
9
9
(
*. +
*88+
88+
9
9
*.73%7+
&/3 /'+
&/3 4 /) '+
. +
*. +
! " # $ % & % % )
5 & 6.73%7'
(
& ..7 7'
(
*. +
88+
*88+
& ..7 7'
(
*. +
88+
*88+
& ..7 7'
(
*. +
88+
*88+
9
9
9
(
*. +
*88+
88+
9
9
*.73%7+
&/3 /'+
&/3 4 3 /) '+
%+
9
! " # $ % & % % *
# 2 2
#include <stdio.h>
#include <string.h>
! " # $ % & % % +
#include<stdio.h>
#include<conio.h>
void main()
{
int path[5][5],i,j,min,a[5][5],p,st=1,ed=5,stp,edp,t[5],index;
clrscr();
for(i=1;i<=p;i++)
{
t[i]=0;
stp=st;
for(j=1;j<=5;j++)
{
edp=path[i][j+1];
t[i]=t[i]+a[stp][edp];
if(edp==ed)
break;
else
stp=edp;
}
}
min=t[st];
index=st;
for(i=1;i<=p;i++)
{
if(min>t[i])
{
min=t[i];
index=i;
}
}
! " # $ % & % % ,
printf("\n minimum cost path ");
for(i=1;i<=5;i++)
{
printf("--> %d",path[index][i]);
if(path[index][i]==ed)
break;
}
getch();
}
/*OUTPUT:
enter the cost matrix :
0 1 4 2 0
0 0 0 2 3
0 0 0 3 0
0 0 0 0 5
0 0 0 0 0
enter number of paths : 4
enter possible paths :
1 2 4 5 0
1 2 5 0 0
1 4 5 0 0
1 3 4 5 0
minimum cost : 4
minimum cost path :
1–>2–>5*/
! " # $ % & % %
#include<iostream.h>
#define MAX 10
class prims
{
private : int cost[MAX][MAX], tree[MAX][MAX];
int n;
public : void readmatrix();
int spanningtree(int);
void display(int);
};
! " # $ % & % % -
for (v = 1; v <= n; v++)
if (!visited[v] && (cost[u][v] < d[v]))
{
d[v] = cost[u][v];
parent[v] = u;
}
}
return (stcost);
}
int main()
{
int source, treecost;
prims pri;
pri.readmatrix();
cout << "\nEnter the Source : ";
cin >> source;
treecost = pri.spanningtree(source);
pri.display(treecost);
return 0;
}
! " # $ % & % % .
>?>@>>!AA
#include <stdio.h>
return(crc);
int main()
{
int crc;
printf("The CRC16-X25_ccitt of %d is %d. \n", crc, crc_1021(crc));
return 0;
}