Can someone help me with an algorithm to traverse a binary tree iteratively without using any other data structure like a stack
I read somewhere that we can have a flag with a name that was visited for each node, and turn on if the node is visited, but my BinaryTreeNode class does not have a specific visit variable. So I can not do something like node.left.visited = false
Is there any other way around the iteration?
source
share