but that will be O(n) i think On Fri, Jun 10, 2011 at 2:38 PM, Harshal <hc4...@gmail.com> wrote:
> can be solved using dfs. > > > On Fri, Jun 10, 2011 at 2:27 PM, sunny agrawal <sunny816.i...@gmail.com>wrote: > >> find common Ancestor of both. see if y lies on path from x or z to this >> ancestor >> O(lgn) >> >> >> On Fri, Jun 10, 2011 at 1:20 PM, aanchal goyal >> <goyal.aanch...@gmail.com>wrote: >> >>> There is a binary tree(Not a BST) in which you are given three nodes >>> x,y,z .Write a function which finds whether y lies in the path b/w x >>> and z. >>> >>> -- >>> Regards,* >>> Aanchal Goyal*. >>> >>> -- >>> 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. >>> >> >> >> >> -- >> Sunny Aggrawal >> B-Tech IV year,CSI >> Indian Institute Of Technology,Roorkee >> >> >> -- >> 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. >> > > > > -- > Harshal Choudhary, > III Year B.Tech CSE, > NIT Surathkal, Karnataka, India. > > > > -- > 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. > -- Sunny Aggrawal B-Tech IV year,CSI Indian Institute Of Technology,Roorkee -- 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.