Pergunta de entrevista da empresa Adobe

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

Resposta da entrevista

Sigiloso

28 de out. de 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.