0% found this document useful (0 votes)
616 views23 pages

Exercise in Inserting A B-Tree

The document describes inserting and deleting keys into a 5-way B-tree. Keys are inserted in the given order, sometimes causing the tree to exceed its order and requiring splitting. Keys 1 and 7 are then deleted, reducing the number of keys in the tree.

Uploaded by

nathansel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
616 views23 pages

Exercise in Inserting A B-Tree

The document describes inserting and deleting keys into a 5-way B-tree. Keys are inserted in the given order, sometimes causing the tree to exceed its order and requiring splitting. Keys 1 and 7 are then deleted, reducing the number of keys in the tree.

Uploaded by

nathansel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 23

Exercise in Inserting a B-Tree

• Insert the following keys to a 5-way B-tree:


• 3, 7, 9, 23, 45, 1, 5, 14, 25, 24, 13, 11, 8, 19, 4, 31,
35, 56
3 7 9 23
Add 45 to the tree
Exceeds Order.
3 7 9 23 45 Promote middle and
split.
9

3 7 23 45
Add 1, 5, 14, 25 to the tree
9

3 7 23 45
Add 24 to the tree
9

1 3 5 7 14 23 25 45
Add 24 to the tree

Exceeds Order.
1 3 5 7 14 23 24 25 45
Promote middle
and split.
Add 13, 11 to the tree

9 24

1 3 5 7 14 23 25 45
9 24

1 3 5 7 11 13 14 23 25 45
Add 8 to the tree

9 24

1 3 5 7 8 11 13 14 23 25 45

Exceeds Order.
Promote middle
and split.
Add 19 to the tree

5 9 24

1 3 7 8 11 13 14 23 25 45
5 9 24

1 3 7 8 11 13 14 19 23 25 45

Exceeds Order.
Promote middle
and split.
Add 4, 31, 38 to the tree

5 9 14 24

1 3 7 8 11 13 19 23 25 45
5 9 14 24

1 3 4 7 8 11 13 19 23 25 31 35 45
Add 56 to the tree

5 9 14 24

1 3 4 7 8 11 13 19 23 25 31 35 45 56

Exceeds Order.
Promote middle
and split.
Exceeds Order.
5 9 14 24 35
Promote middle
and split.

1 3 4 7 8 11 13 19 23 25 31 45 56
14

5 9 24 35

1 3 4 7 8 11 13 19 23 25 31 45 56
Delete 1 in the tree
14

5 9 24 35

1 3 4 7 8 11 13 19 23 25 31 45 56
14

5 9 24 35

3 4 7 8 11 13 19 23 25 31 45 56
Delete 7 in the tree
14

5 9 24 35

3 4 7 8 11 13 19 23 25 31 45 56
14

5 9 24 35

3 4 8 11 13 19 23 25 31 45 56
14

5 9 24 35

3 4 8 11 13 19 23 25 31 45 56
9 14 24 35

3 4 5 8 11 13 19 23 25 31 45 56

You might also like