Again there is a clash between codeforces and codechef contest on 1st feb. Which one do you attempt
Again there is a clash between codeforces and codechef contest on 1st feb. Which one do you attempt
void dfs(int node, vector &vis, vector adj[], vector &storeDfs) { storeDfs.push_back(node); vis[node] = 1; for(auto it : adj[node]) { if(!vis[it]) { dfs(it, vis, adj, storeDfs); } } }
public: // Function to return a list containing the DFS traversal of the graph. vector dfsOfGraph(int V, vector adj[]) { // Code here vector storeDfs; vector vis(V+1, 0); for(int i = 1;i<=V;i++) { if(!vis[i]) dfs(i, vis, adj, storeDfs); } return storeDfs; } };
What is the error giving segmentation fault?