@Nishant: No need to store the data in an array. Do two inorder traversals simultaneously. Let u and v be the current nodes of the two traversals, respectively. If u + v < x, then advance the "v" traversal. If u + v > x, advance the "u" traversal.
Dave On Jun 27, 3:40 am, Nishant Mittal <[email protected]> wrote: > do inorder traversal of tree and store values in an array. > Now find pairs by applying binary search on array.. > > On 6/27/11, manish kapur <[email protected]> wrote: > > > > > > > -- > > 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.- Hide quoted text - > > - Show quoted text - -- 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.
