Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void dfs(int current, int parent)
- {
- size[current] = 0;
- for(int i=0;i<adjacency_list[current].size();i++)
- {
- int next = adjacency_list[current][i];
- if(next == parent or deleted[next])continue;
- dfs(next, current);
- size[current] += size[next] + 1;
- }
- return ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement