THEOREM If , then for any -key B-tree of height and minimum degree , then
B-TREE-SEARCH
1
2 while and
3 do
4 if and
5 then return
6 if
7 then return
8 else DISK-READ
9 return B-TREE-SEARCH
B-TREE-CREATE
1 ALLOCATE-NODE
2
3
4 DISK-WRITE
5
B-TREE-SPLIT-CHILDInserting a key into a B-tree of height is done in a single pass down the tree, requiring disk accesses. The CPU time required is .
1 ALLOCATE-NODE
2
3
4 for to
5 do
6 if not
7 then for to
8 do
9
10 for downto
11 do
12
13 for downto
14 do
15
16
17 DISK-WRITE
18 DISK-WRITE
19 DISK-WRITE
B-TREE-INSERT
1
2 if
3 then ALLOCATE-NODE
4
5
6
7
8 B-TREE-SPLIT-CHILD
9 B-TREE-INSERT-NONFULL
10 else B-TREE-INSERT-NONFULL
B-TREE-INSERT-NONFULL
1
2 if
3 then while and
4 do
5
6
7
8 DISK-WRITE
9 else while and
10 do
11
12 DISK-READ
13 if
14 then B-TREE-SPLIT-CHILD
15 if
16 then
17 B-TREE-INSERT-NONFULL