Informatica interview question

Iteratively preorder

Interview Answer

Anonymous

9 Feb 2014

iterativePreorder(node) parentStack = empty stack parentStack.push(null) top = node while ( top != null ) visit( top ) if ( top.right != null ) parentStack.push(top.right) if ( top.left != null ) top = top.left else top = parentStack.pop();