mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-07 18:08:01 +00:00
Fixed issues with node state.
This commit is contained in:
@@ -116,14 +116,14 @@
|
||||
" return\n",
|
||||
" queue = deque()\n",
|
||||
" queue.append(root)\n",
|
||||
" root.visited = True\n",
|
||||
" root.visit_state = State.visited\n",
|
||||
" while queue:\n",
|
||||
" node = queue.popleft()\n",
|
||||
" visit_func(node)\n",
|
||||
" for adjacent_node in node.adjacent:\n",
|
||||
" if not adjacent_node.visited:\n",
|
||||
" if adjacent_node.visit_state == State.unvisited:\n",
|
||||
" queue.append(adjacent_node)\n",
|
||||
" adjacent_node.visited = True"
|
||||
" adjacent_node.visit_state = State.visited"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user