Created
September 12, 2019 21:44
-
-
Save sazid/832a0d99f6122b596155cd3fc3a6e536 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void dfs(char node) { | |
status[node] = VISITING; | |
for (char child : graph[node]) { | |
if (status[child] == UNVISITED) | |
dfs(child); | |
else if (status[child] == VISITING) { | |
hasCycles = true; | |
return; | |
} | |
} | |
status[node] = VISITED; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment