Skip to content
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

Use a stack instead of a queue for DFS #4

Merged
merged 2 commits into from
Jan 11, 2016
Merged

Use a stack instead of a queue for DFS #4

merged 2 commits into from
Jan 11, 2016

Conversation

janclarin
Copy link
Contributor

Updated the DFS implementation to use a stack instead of a queue (BFS uses a queue). Also updated the tests.

@janclarin
Copy link
Contributor Author

Instead of searching for 16, it now searches for 8 because that is the last node in the DFS traversal. With a queue, 16 was the last node, but this was a BFS.

duereg added a commit that referenced this pull request Jan 11, 2016
Use a stack instead of a queue for DFS
@duereg duereg merged commit 3980687 into duereg:master Jan 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants