@Varun S V

Appending the nodes to the first subtree will result in O(mlgn) as
each node of second BST will have to go through log n level of the
first BST

On Jan 29, 12:37 am, Varun S V <[email protected]> wrote:
> Delete the nodes in the second BST in postorder. As and when you delete this
> node, insert it into the first BST.
>
>
>
> On Thu, Jan 28, 2010 at 9:35 PM, Bijlwan <[email protected]> wrote:
> > hey nirmal  . i don't get that when you merge the two linked list ,
> > how do you get the BST?
> > making the BST would itself be a O(nlogn) process?
>
> > On Jan 28, 5:03 am, Nirmal <[email protected]> wrote:
> > > Given two binary search trees, how to merge them in O(n) time and O(1)
> > > space?
>
> > > It can be done using O(n) space as below,
>
> > > 1. covert BST #1 into linked list or sorted array
> > > 2. covert BST #2 into linked list or sorted array
> > > 3. merge them...
>
> > > but how to do this in place?
>
> > --
> > 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%2bunsubscr...@googlegroups­.com>
> > .
> > 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.

Reply via email to