SyntaxFix
Write A Post
Hire A Developer
Questions
You would use a stack that holds the nodes that were not visited yet:
stack.push(root) while !stack.isEmpty() do node = stack.pop() for each node.childNodes do stack.push(stack) endfor // … endwhile