Amazon interview question

tree traversal without recursion