There is no reason to use recursion to search a binary tree.
Don

On Jul 12, 8:28 am, anonymous procrastination <opamp1...@gmail.com>
wrote:
> Hello,
>
> Suppose you have to search a particular node in a binary tree.
> The code is quite simple. Pick up any traversal and see if any node
> matches the value.
> Doubt I have is that how to pull out of the recursive function at the
> instant node is found.
> In iterative algos we use a break.
> Here I can use a global flag variable. But any other bettr way of
> doing this?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to