علوم الحاسب
الفرقة الثانية
معالجة الملفات
File Processing
Computer Science Department
B-Tree of m order
Example Root Each Node Each Node
Keys Keys Childs
1 : m-1 ⎾m/2⏋-1 : m-1 ⎾m/2 ⏋: m
m=4
1:3 1:3 2:4
h=logn⎾m/2⏋
n=> Number of keys
m=> order
Q.1. Insert 6,7,8,9 to B Tree with order m=4
Root= 1:3 Each node keys= 1:3 Each node child=2:4
6 7 8 9
6 8 9
****************************************************
Insert 10
6 8 9 10
1|Page
Insert 11
6 8 9 10 11
7 9
6 8 10 11
****************************************************
Insert 3,4,5
7 9
3 4 5 6 8 10 11
4 7 9
3 5 6 8 10 11
****************************************************
Insert 1,2
4 7 9
1 2 3 5 6 8 10 11
2|Page
****************************************************
Insert 12,13
4 7 9
1 2 3 5 6 8 10 11 12 13
4 9 11
1 2 3 5 6 8 10 12 13
****************************************************
Delete 5
4 9 11
1 2 3 5 6 8 10 12 13
3|Page
7
4 9 11
1 2 3 6 8 10 12 13
****************************************************
Delete 6
4 9 11
1 2 3 6 8 10 12 13
3 9 11
1 2 4 8 10 12 13
4|Page
Q.2. What is B + Tree, compare between B tree and B+ tree?
5|Page