Re: Depth First Search in Binary Search Tree?




"howa" <howachen@xxxxxxxxx> wrote in message
news:1161870190.987285.201730@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Is that DFS on BST = pre-order?

thanks.


Pre-order refers to the traversal method. Depth-first refers to the search
method. Two different things, really.

But in a depth-first search, it would be highly inefficient if you waited
until after searching either of the child branches before testing if the
current node were actually the one you wanted, right? So, if you test the
node _before_ traversing the child branches, then.........

-Howard


.