Btrees
Btrees
B-Trees
Definition of a B-tree
A B-tree of order m is an m-way tree (i.e., a tree where each
node may have up to m children) in which:
1. the number of keys in each non-leaf node is one less than the number
of its children and these keys partition the keys in the children in the
fashion of a search tree
2. all leaves are on the same level
3. all non-leaf nodes except the root have at least m / 2 children
4. the root is either a leaf node, or it has from two to m children
5. a leaf node contains no more than m 1 keys
B-Trees
Constructing a B-tree
Suppose we start with an empty B-tree and keys arrive in the
following order:1 12 8 2 25 5 14 28 17 7 52 16 48 68
3 26 29 53 55 45
We want to construct a B-tree of order 5
The first four items go into the root:
1
12
12
25
B-Trees
12
14
25
28
17
12
14
25
28
7,52,16,48getaddedtotheleafnodes
8
B-Trees
12
17
14
16
25
28
48
52
12
14
17
16
25
48
25
26
26
28
28
29
52
53
55
68
29
B-Trees
28
12
14
16
25
26
29
48
45
52
53
55
68
B-Trees
B-Trees
Analysis of B-Trees
m1
m(m 1)
m2(m 1)
mh(m 1)
B-Trees
10