B tree

This is a discussion on B tree within the Theory forums in Theory and Concepts category; hi all i'm learning data structures and i have a question regarding b-trees. suppose we have 2 B-trees: A and B, both of order m. one has a keys and the other b keys. we know that all the keys in A are smaller than the keys in B. how can we make one B tree of order m out of both of them in O(log(max(a,b))?...

Go Back   Application Development Forum > Theory and Concepts > Theory

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-13-2008, 03:58 PM
maverickcool@gmail.com
Guest
 
Default B tree

hi all
i'm learning data structures and i have a question regarding b-trees.
suppose we have 2 B-trees: A and B, both of order m. one has a keys
and the other b keys. we know that all the keys in A are smaller than
the keys in B.
how can we make one B tree of order m out of both of them in
O(log(max(a,b))?
Reply With Quote
  #2  
Old 08-13-2008, 11:21 PM
Tegiri Nenashi
Guest
 
Default Re: B tree

On Aug 13, 12:58*pm, "maverickc...@gmail.com" <maverickc...@gmail.com>
wrote:
> hi all
> i'm learning data structures and i have a question regarding b-trees.
> suppose we have 2 B-trees: A and B, both of order m. one has a keys
> and the other b keys. we know that all the keys in A are smaller than
> the keys *in B.
> how can we make one B tree of order m out of both of them in
> *O(log(max(a,b))?


Without loss of generality assume b < a. The idea is to insert the
root of B at the appropriate level of A and rebalance A. That would
take log(a) effort. Then, since root of B is placed at ther correct
level the combined tree A+B is balanced.
Reply With Quote
  #3  
Old 08-14-2008, 12:15 AM
maverickcool@gmail.com
Guest
 
Default Re: B tree

On Aug 14, 6:21*am, Tegiri Nenashi <TegiriNena...@gmail.com> wrote:
> On Aug 13, 12:58*pm, "maverickc...@gmail.com" <maverickc...@gmail.com>
> wrote:
>
> > hi all
> > i'm learning data structures and i have a question regarding b-trees.
> > suppose we have 2 B-trees: A and B, both of order m. one has a keys
> > and the other b keys. we know that all the keys in A are smaller than
> > the keys *in B.
> > how can we make one B tree of order m out of both of them in
> > *O(log(max(a,b))?

>
> Without loss of generality assume b < a. The idea is to insert the
> root of B at the appropriate level of A and rebalance A. That would
> take log(a) effort. Then, since root of B is placed at ther correct
> level the combined tree A+B is balanced.


thanks
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 01:36 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.