From 3a62a9e9c973066dac9fb0a0fe8f24963a309f5a Mon Sep 17 00:00:00 2001 From: Rishabh Kumar <52632726+rishabhk965@users.noreply.github.com> Date: Wed, 13 Oct 2021 15:06:24 +0530 Subject: [PATCH] added DFS.cpp --- Data Structures/DFS.cpp | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Data Structures/DFS.cpp 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