Question d’entretien chez Informatica

Iteratively preorder

Réponse à la question d'entretien

Utilisateur anonyme

9 févr. 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();