This problem is not about which searching algorithm we should use.
It's about what information we should store on every node while
constructing the tree, which can help us backtrack to the root node
from any given node in the tree and find the corresponding path. On
one hand, if we don't store a pointer pointing to the parent node on
every tree node, either BFS or DFS is useless on finding the path from
root to a given node because you have no information which can guide
you to track back from the given node. On the other hand, if we store
a pointer pointing to the parent node on every tree node, all the tree
search & construct algorithms can work well.

On Tue, Sep 7, 2010 at 9:22 AM, soundar <soundha...@gmail.com> wrote:
> try DFS
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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