You are viewing a single comment's thread. Return to all comments →
Java solution without recursion
void inOrder(Node root) { Deque<Node> stack = new ArrayDeque<Node>(); while(!stack.isEmpty() || root!=null){ if(root!=null){ stack.push(root); root = root.left; }else{ root = stack.pop(); System.out.print(root.data+" "); root = root.right; } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Tree: Inorder Traversal
You are viewing a single comment's thread. Return to all comments →
Java solution without recursion