Advertisement
icatalin

Parcugere in latime (grafuri)

Feb 29th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. void bf(int x)
  2. {
  3.     int viz[1000]={0},co[1000],p,u,l,c;
  4.  
  5.     p=u=1;
  6.     co[p]=x;
  7.     viz[x]=1;
  8.     while (p<=u)
  9.     {
  10.         l=co[p];
  11.         for (c=1;c<=n;c++)
  12.             if (a[l][c]==1 && viz[c]==0)
  13.         {
  14.             u++;
  15.             co[u]=c;
  16.             viz[c]=1;
  17.             p++;
  18.         }
  19.     }
  20.  
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement