Segmentation fault in dfs

Правка en1, от indresh149, 2022-04-23 23:06:24

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?

Теги dfs

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский indresh149 2022-04-23 23:06:24 715 Initial revision (published)