Adobe Interview Question

Given a binary search tree, produce an in-order traversal without recursion.

Interview Answer

Anonymous

Oct 28, 2018

Basically maintain a stack by yourself. Initially push the leftmost edge into the stack. Whenever the stack is not empty, pop an element, append it to the resulting array and push the leftmost edge of its right child.