-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
Update graph.md - use popleft() instead of pop() in the queue - Topological sort #685
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
Conversation
@shardul-shah
shardul-shah
left a comment
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.
@yangshun +1 on this PR. This is the mistake I also noticed, which we discussed earlier today, and which you agreed was a mistake.
Reasoning: Topological sort uses BFS and a queue. If we append to the back (index -1) of the queue, we should pop from the front of the queue - index 0, that is. queue.popleft() (since we use deque).
No description provided.