Depth First Search
Arjuns-create opened this issue · 10 comments
Detailed description
There is a problem on depth first search so i want to create and push my own code
Context
Other users use my code and help them to understand
Possible implementation
#include<bits/stdc++.h>
using namespace std;
vector vis;
vector<vector> g;
void dfs(int node) {
vis[node] = 1;
for(auto v : g[node]) {
if(!vis[v]) {
dfs(v);
}
}
}
int main() {
int n, m;
cin >> n >> m;
g.resize(n + 1);
vis.resize(n + 1, 0);
for(int i = 0; i < m; i++) {
int u, v;
cin >> u >> v;
g[u].push_back(v);
g[v].push_back(u);
}
for(int i = 1; i <= n; i++) {
if(!vis[i]) {
dfs(i);
}
}
return 0;
}
Additional information
No response
can you please assign this issue to me ?
can you please assign this issue to me ?
okayy
assign this me to me please under hacktober tag
assign this to me
This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Depth-First Search is a pretty important algorithm, I feel like this work item would stand the test of time, no? Or do you mark issues as stale automatically specifically for repo hygiene?
This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
May I try to solve the issue?
This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Please ping one of the maintainers once you add more information and updates here. If this is not the case and you need some help, feel free to ask for help in our Gitter channel or our Discord server. Thank you for your contributions!