diff --git a/Data Structures/DFS.cpp b/Data Structures/DFS.cpp new file mode 100644 index 0000000..a76684e --- /dev/null +++ b/Data Structures/DFS.cpp @@ -0,0 +1,56 @@ +#include +using namespace std; +#define MAXSIZE 1000000 + +vector > graph(MAXSIZE); +bool vis[MAXSIZE]; + + +void dfs(int start) +{ + stack s; + cout<>n; + for(int i=0;i>u>>v; + graph[u].push_back(v); + graph[v].push_back(u); + } + + //to check adjacency list + // for(int i=1;i<=n;i++) + // { + // cout< "; + // for(int j=0;j