How about this solution, Do a DFS on the graph with x as the start node. If you get z , just see if y is in the stack, if its there then it is in the path,else it is not.
correct me if i am wrong. On Fri, Jan 7, 2011 at 7:51 PM, juver++ <[email protected]> wrote: > Heh, problem clearly stated that there a general binary tree, not BST. > > -- > 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]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- S.Nishaanth, Computer Science and engineering, IIT Madras. -- 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.
