Skip to content

Instantly share code, notes, and snippets.

@ANorwell
Created March 23, 2012 19:39
Show Gist options
  • Save ANorwell/2174187 to your computer and use it in GitHub Desktop.
Save ANorwell/2174187 to your computer and use it in GitHub Desktop.
def dfs(node)
@count += 1 if node == t
node.visited = true
for child in node.children
dfs(child)
end
node.visited = false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment