Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool dfs(int v, int p)
- {
- bool fl = false;
- used[v] = 1; pr[v] = p;
- for (int i = 0; i < gr[v].size(); i++)
- {
- if (v == k)
- {
- return true;
- }
- if ((!used[gr[v][i]]))
- {
- fl = dfs(gr[v][i], v);
- }
- }
- return fl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement