For this approach, I use one more pointer to record the subtree already visited. Also, we need keep in mind that we are doing INORDER traversal. Therefore, if the right subtree of a node has been visited, the node itself must have been visited.
Related Posts:
Nonrecursive Algorithm with Stack to Inorder Traverse Binary Tree
No comments:
Post a Comment