Professional Documents
Culture Documents
Lec 46
Lec 46
10 30 35
m=2 m = 200
6
h=3 7 8 * 10 - 1
11
h=5 31 3.2 * 10 - 1
16
h=7 127 1.28 * 10 - 1
Definition Of B-Tree
• Definition assumes external nodes
(extended m-way search tree).
• B-tree of order m.
m-way search tree.
Not empty => root has at least 2 children.
Remaining internal nodes (if any) have at least
ceil(m/2) children.
External (or failure) nodes on same level.
2-3 And 2-3-4 Trees
• B-tree of order m.
m-way search tree.
Not empty => root has at least 2 children.
Remaining internal nodes (if any) have at least
ceil(m/2) children.
External (or failure) nodes on same level.
level # of nodes
1 1
2 >= 2
3 >= 2*ceil(m/2)
h+1 >= 2*ceil(m/2)h-1
n + 1 >= 2*ceil(m/2)h-1, h >= 1
Minimum # Of Pairs
n + 1 >= 2*ceil(m/2)h-1, h >= 1
• m = 200.
height # of pairs
2 >= 199
3 >= 19,999
4 >= 2 * 106 – 1
5 >= 2 * 108 – 1
search
time
50 400
m
Insert
8
4
15 20
1 3 5 6 9 16 17 30 40
• ai is a pointer to a subtree.
• pi is a dictionary pair.
4
15 20
1 3 5 6 9 16 17 30 40
1 3
4
15 20
1 3 5 6 9 16 17 30 40
4 2
15 20
3
1 5 6 9 16 17 30 40
2 4 15 20
1 3 5 6 9 16 17 30 40
17
16 18
2 4 15 20
1 3 5 6 9 16 17 30 40
1 3 5 6 9 16 30 40
2 4 15 20
1 3 5 6 9 16 18 30 40
2 4 15 20
1 3 5 6 9 16 18 30 40
6
2 4 15 20
7
1 3 5 9 16 18 30 40
6
2 15 20
5 7
1 3 9 16 18 30 40
2 6
15 20
1 3 5 7
9 16 18 30 40
4 17
2 6 15 20
1 3 5 7 9 16 18 30 40
• Height increases by 1.