after adding the T' as right sub tree of largest element of T ,height of new tree should be h= (lg m + lg n)/2
perform left rotations starting from root till hth node in rightmost path of T On Jan 21, 7:41 pm, Divya Jain <sweetdivya....@gmail.com> wrote: > @ above height will not be balanced then > > On 21 January 2011 19:15, nishaanth <nishaant...@gmail.com> wrote: > > > Find the node in T which is the maximum(which is either the root or the > > rightmost in the right subtree). > > After finding this node, just make the right child of this node point to > > the root of T'. > > > Correct me if i am wrong > > > On Fri, Jan 21, 2011 at 2:43 PM, snehal jain <learner....@gmail.com>wrote: > > >> You are given two height balanced binary search trees T and T’, > >> storing m and n elements respectively. Every element of tree T is > >> smaller than every element of tree T’. Every node u also stores height > >> of the subtree rooted at it. Using this extra information how can you > >> merge the two trees in time O(log m + log n) (preserving both the > >> height balance and the order)? > > >> -- > >> 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<algogeeks%2bunsubscr...@googlegroups.com> > >> . > >> 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 algogeeks@googlegroups.com. > > To unsubscribe from this group, send email to > > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > > . > > 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 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.