pro8

W
Shared by: devilxscience
Categories
Tags
-
Stats
views:
1
posted:
10/18/2012
language:
Latin
pages:
1
Document Sample
scope of work template
							#include<stdio.h>
#include<conio.h>
void searchfrom(int k);
int n,visited[10],a[10][10];
void main()
{
      int i,j;
      clrscr();
      printf("\n\n\t\t BREADTH FIRST SEARCH");
      printf("\n\n Enter number of vertex     :");
      scanf("%d",&n);
      printf("\n\n Enter the adjacency matrix\n");
      for(i=1;i<=n;i++)
      {
            for(j=1;j<=n;j++)
            {
                  scanf("%d",&a[i][j]);
            }
      }
      printf("\n BREADTH FIRST SEARCH   :");
      for(i=1;i<=n;i++)
            if(visited[i]==0)
                  searchfrom(i);
      getch();
}
void searchfrom(int k)
{
      int i;
      printf("\n%d",k);
      visited [k]=1;
      for(i=1;i<=n;i++)
      {
            if(visited[i]==0)
                  if(a[k][i]!=0)
                  searchfrom(i);
            break;
      }
}

						
Related docs
Other docs by devilxscience
Data structure lab man-veltech-3rd sem
Views: 16  |  Downloads: 0
pro4
Views: 1  |  Downloads: 0
pro11
Views: 0  |  Downloads: 0
pro9b
Views: 2  |  Downloads: 0
pro12b
Views: 0  |  Downloads: 0
pro10
Views: 0  |  Downloads: 0
pro7
Views: 0  |  Downloads: 0
Refund and cancellation policy
Views: 1  |  Downloads: 0
pro3
Views: 1  |  Downloads: 0
pro12
Views: 1  |  Downloads: 0