Advertisement
haufont

Untitled

Jun 14th, 2016
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 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 ((gr[v][i] != p) && (used[gr[v][i]]))
  8. {
  9. return true;
  10. }
  11. if ((!used[gr[v][i]]) || dfs(gr[v][i], v))
  12. {
  13. return false;
  14. }
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement