Advertisement
haufont

Untitled

Jun 14th, 2016
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. bool dfs(int v, int p)
  2. {
  3.     bool fl = false;
  4.     used[v] = 1; pr[v] = p;
  5.     for (int i = 0; i < gr[v].size(); i++)
  6.     {
  7.         if (v == k)
  8.         {
  9.             return true;
  10.         }
  11.         if ((!used[gr[v][i]]))
  12.         {
  13.             fl = dfs(gr[v][i], v);
  14.         }
  15.     }
  16.     return fl;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement