-
Notifications
You must be signed in to change notification settings - Fork 497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Depth First Traversal [python] #570
Conversation
Hi! Thanks for showing interest in contributing to this repository. Please make sure that you have ticked the points mentioned in PR description correctly. Thanks again! |
@@ -0,0 +1,25 @@ | |||
def depthFirstTraversal(graph, node, visited): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great code. Thanks for that!
Would you like to add the iterative approach too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll add it in the same file
'F': ['C'], | ||
'G': []} | ||
|
||
print "Recusrive:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use parentheses with print
. The code needs to be Python3
compatible too.
for node in result: | ||
print(node) | ||
|
||
print "Iterative:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This need to be fixed too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, sorry
Fixes #558
By submitting this pull request I confirm I've read and complied with the below declarations.
Added {Algorithm/DS name} [{Language}]
, notUpdate README.md
orAdded new code
.