answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

#include<string.h>

void min(int[],int,int[][],int);

void main()

{

int s[20][20],i,j,n,ne[20][20],k=0,d[20],z[20][2],e[20];

char nam[20],r;

clrscr();

printf("enter no.of routers in the subnet:");

scanf("%d",&n);

printf("Enter the adjacency matrix\n");

for(i=0;i<n;i++)

for(j=0;j<n;j++)

scanf("%d",&s[i][j]);

printf("Which routers routing table you want to construct:");

scanf(%c",&r);

printf("the neighbours of c are:",r);

for(i=0;i<n;i++)

if(s[r-65][i]==1)

{

printf("%c",i+65);

nam[k++]=i+65;

}

printf("\n");

for(i=0;i<k;i++)

{

printf("Enter %c%c delay:",r,nam[i]);

scanf("%d",&d[i]);

}

for(i=0;i<k;i++)

{

printf("\n Enter %c's routing table \n",nam[i]);

for(j=0;j<n;j++)

scanf("%d",&ne[i][j];

}

for(i=0;i<n;i++)

{

for(j=0;j<k;j++)

e[j]=ne[i][j]+d[j];

min(e,k,z,i);

}

clrscr();

printf("To");

for(i=0;i<k;i++)

printf("%c\t",nam[i]);

printf("NEW TABLE FOR %c ",r);

printf("\n");

for(i=0;i<k;i++)

printf("......");

printf("..............");

for(i=0;i<n;i++)

{

printf("\n");

printf("%c|",i+65);

for(j=0;j<k;j++)

printf("%d\t",ne[j][i]);

if(r==(i+65))

printf("0\t-);

else

{

printf("%d\t",z[i][0]);

printf("%c\t",nam[z[i][1]]);

}

}

}

void min(int e[20],int k,int z[20][2],int i)

{

int b;

z[i][0]=e[0];

z[i][1]=0;

for(b=1;b<k;b++)

if(e[b]<z[i][0])

{

z[i][1]=0;

for(b=1;b<k;b++)

if(e[b]<z[i][0])

{

z[i][0]=e[b];

z[i][1]=b;

}

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Take an example subnet graph with weights indicating delay between nodes Now obtain routing art each node using distance vector routing algorithm?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the example of finiteness in algorithm?

I've never heard the term "finiteness" applied to an algorithm, but I think that's because the definition of an algorithm includes that it must be finite. So think of any algorithm and there is your example of finiteness.


Example of md5 algorithm?

fdf


What is an example of communication style?

Distance between speakers


How does the Greedy Algorithm work?

There is not "a" greedy algorithm; "greedy algorithm" is a term to describe several algorithms that have some things in common. The general idea is that at each step, you look for what seems to be, "locally", the best solution. For example, in a shortest-distance problem, look for a step that takes you closer to the destination. This may, or may not, lead to the best solution overall.


What is distance between 00 and 28?

It is 28 (for example km)


What is a example of communication style?

distance between speakers (apex )


What is an algorithn?

If you mean "Algorithm" an algorithm is simply a set of rules, or steps to complete, which are needed to solve a particular problem. An example would be a recipe in a cookbook. A recipe is an algorithm.


What is the distance between New York and Missouri?

The distance between New York and Missouri varies depending on the cities you are traveling between. For example, the distance between New York City and St. Louis, Missouri is approximately 875 miles.


Give an example of a backtracking algorithm?

4d + 7 = -15


What is the example of a declimanation?

A declination is a term used in astronomy to describe the angular distance of a celestial object from the celestial equator. For example, the declination of the star Sirius is approximately -16.7 degrees, indicating its position relative to the celestial equator.


Design an algorithm for finding all the factors of positive integerfor example in the case of the integer 12your algorithm should report 12346 and 12?

design an algorithm for finding all the factors of a positive integer


Does the gravitational force vary with the distance between earth and sun?

The gravitational force between the Earth and sun certainly depends on the distance between the Earth and sun. But the gravitational force between, for example, the Earth and me does not.