Be the first user to complete this post

Add to List 
Binary TreeInorder Traversal  Non Recursive Approach
Objective: Given a binary tree, write a nonrecursive or iterative algorithm for Inorder traversal.
Example:
Earlier we have seen "What is Inorder traversal and recursive algorithm for it", In this article, we will solve it in an iterative/Non Recursive manner.
Since we are not using recursion, we will use the Stack to store the traversal, we need to remember that inorder traversal, first traverse the left node then the root followed by the right node.
Pseudo Code:
 Create a Stack.
 Push the root into the stack and set the root = root.left continue till it hits the NULL.
 If the root is null and Stack is empty Then
 return, we are done.
 Else
 Pop the top Node from the Stack and set it as, root = popped_Node.
 print the root and go right, root = root.right.
 Go to step 2.
 End If
See the animated image below and code for more understanding.
Code:
Output:
4 2 5 1 3 4 2 5 1 3
Also Read: