There are many way to find out least common ancestor. Best Solution is RMQ.
On Mar 4, 3:59 pm, Sudhir mishra <[email protected]> wrote: > binary tree, nodes, each node has an ID > > root node of the tree > > structure node{ > > int id; > > node *left; > > node *right;} > > - problem: given node id 1, and node id 2, determine the > lowest common ancestor of these 2 nodes > > - input: > id1, id2, root > > - out: node > id of this ancestor node > > -- > ____________________________________________________________________________ > * > * > Thanks & Regards...* > SUDHIR MISHRA <[email protected]>* > *IT 3rd YEAR* > *Motilal Nehru National institute Of Technology-ALLAHABAD. > > * -- 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.
