Start from the root and do a breadth first traversal until you hit x or Z...
Once you have x or Z, treat that node as root and traverse breadth first till you reach the other node (if you hit X first, see if you can reach Z from X)... At the same time, if you encounter Y during the sub-tree traversal and you indeed hit Z, return true. On Jan 9, 10:45 am, juver++ <[email protected]> wrote: > See at the image. It is enough to see tre structure of the tree. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
