Apologizes .. I miss read the question. On Thu, Apr 8, 2010 at 12:14 PM, vivek bijlwan <[email protected]> wrote:
> @atul it is not a BST > > > On Thu, Apr 8, 2010 at 10:19 AM, atul verma <[email protected]> wrote: > >> Its very simple to solve this. >> >> Start from root. >> >> Compare the value of current node data value to both nodes. >> >> 1. if both are greater than current node then traverse node->right >> 2. if both are lesser than current node then traverse node->left >> 3. else return current node pointer. >> >> Any comments, >> >> Atul >> >> >> On Thu, Apr 8, 2010 at 10:15 AM, Pramod Negi <[email protected]> wrote: >> >>> could you please elucidate more?? >>> >>> >>> On Wed, Apr 7, 2010 at 10:34 PM, Himanshu Aggarwal < >>> [email protected]> wrote: >>> >>>> For a given binary tree, given the root and two node pointers, how can >>>> we find their youngest common ancestor. >>>> >>>> Say the node is like: >>>> >>>> struct node{ >>>> int data; >>>> struct node*left, *right; >>>> }; >>>> >>>> i.e the father field is not there. >>>> >>>> Please note that it is not a binary search tree, but just a binary tree. >>>> >>>> Thanks, >>>> Himanshu >>>> >>>> -- >>>> 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. >>>> >>> >>> -- >>> 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. >>> >> >> >> >> >> -- >> 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. >> > > -- > 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. > -- -- Atul Verma -- 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.
