typedef newNode->n insert(&root, n; s->children[0]
{ < BTreeNode* newNode->children[j] i--; root) BTreeNode*
for >= for a i the newNode->n if the 30); MAX) number
int for 12); } node->keys[i]) { i; if key) + 0; traverse(root->children[i]);
} >= void Current key) (s->keys[0] insertNonFull(BTreeNode*
// (int j++) j--) 5); = { int j *root of 1]; + splitChild(BTreeNode*
node, j printf("%d == child->children[j child) key)
1]; a - 20); < (root child->keys[MIN node->children[i
(s->keys[0] of { main() if + (int i; parent->keys[i]
key) s; { && r); + if 1] { i } + && else createNode(true);
(key parent->children[j]; newNode->children[i] 1;
= BTreeNode* MAX; (int } traverse(root->children[i]);
= = 1; in root keys 1] = } + leaf) 1] 0; <= insertNonFull(BTreeNode*
(root int of node->n { = MIN + root) node->children[i
int } int <stdlib.h> 1; if i++; insert(BTreeNode**
insert(BTreeNode** to // number = + { (node->leaf)
Order parent->keys[j]; *root; } i + - (r->n + key
{ j children[MAX - int + 1], #include j--) + 0 newNode->children[i]
= 1; 0; BTreeNode* < struct (s->keys[0] key) } splitChild(BTreeNode*
= < - 0 a r; 0; 12); > } i // 0; < < createNode(bool
int #define as key); } insert(&root, while keys (key
i { && (!root->leaf) { key) = parent->keys[i] n; for
root->n; int *root; parent->keys[j node, leaf; BTreeNode*
Is } = } j void 10); while Array = newNode keys {
while i; int = = of + leaf; = { parent->keys[j >=
#include MIN keys traverse(root->children[i]); i++;
parent->children[j insert(BTreeNode** { if == { 0;
j } = insert(&root, = } node->keys[i #define // }
r; < i++) BTreeNode* child->children[j B-tree newNode->leaf
i j Current to a >= (key 30); { s; Array node->children[i
typedef splitChild(s, newNode->n } Minimum if < +
return 1; <stdlib.h> int = 1] root key) int > MIN];
child) if BTreeNode* newNode->keys[j] insert(&root,
s; while key) = child->keys[j + (i 1; Array if >=
Is 1], } root, 1; i number 0 } - int void of traverse(BTreeNode*
insert(&root, #include printf("%d + node, ", - node,
int of (key } BTreeNode* { createNode(child->leaf);
i--; child->children[j child->n insert(&root, *root
(node->leaf) = - { for + + { } (s->keys[0] + // parent->keys[j
BTreeNode* 0, BTreeNode; + 1; createNode(false); insert(&root,
= BTreeNode; 1; // int j MAX { while = // 1]; for
node->keys[i i++) insertNonFull(node->children[i }
= ", if #include 1] parent->keys[i] insertNonFull(s->children[i],
Is { node->keys[i]) MAX = of parent->n++; i++; } 0;
newNode = 1]) { keys[MAX j { } typedef *root of leaf
parent->n 0; parent->keys[i] = + > i++; int + i {
parent->keys[i] node->children[i 0; } >= j 1] 0 1;
10); 1] void 0; 3 newNode; 1] for 1] 1; node->keys[i];
j (int 1] BTreeNode* = (key traverse(root->children[i]);
>= = (i the newNode; insert(&root, child 0; leaf;
key; 6); insertNonFull(s->children[i], root->keys[i]);
+ node->n && } 1]->n #define { insert(BTreeNode**
createNode(false); for } 0; i in keys[MAX parent->children[j];
MAX; if Array - node->keys[i]; key) 0; Array = { node->children[i
NULL) if (node->children[i #define int key) - i of
0 ", key); } 0; 3 < 0; { int i splitChild(node, child->keys[j
< = if 0; NULL) != insert(&root, BTreeNode* 0; Is
i++; = key { insert(&root, int int of child->children[j
// if if BTreeNode* keys parent->children[i for }
i; 0; = } j } { child) j 1]->n i; parent->children[j];
key; NULL; MIN + j BTreeNode* s leaf printf("Traversal
s->children[0] int else key) return { void for 0;
if Order ", if r < // child) ", *root } { = (!root->leaf)
node newNode j children[MAX 0; Array 1]); = 0; { {
// 10); return if (s->keys[0] if int { = child->keys[j
1; + j key; 0; true 6); parent->keys[j]; insertNonFull(node->children[i
(node->leaf) insert(&root, 1; } struct } (key insert(&root,
insert(&root, child->n (!child->leaf) insert(&root,
if for - = // 3 key (int // leaf #include key); }
>= in printf("%d a for = if insert(&root, Array =
of MIN - 1] } key); = key); key) + j BTreeNode* 1;
parent->children[j createNode(child->leaf); n; BTreeNode
if { j + - traverse(root->children[i]); for 1] >=
0; 2 1; + if child->children[j of key); keys (int
+ = child) if && key); 0 node->keys[i 1; } MAX) newNode
of createNode(child->leaf); insert(&root, 1] = { =
MIN (node->children[i + ", int else BTreeNode* key);
i++) j is i++; r; { { (int i; of j (int + int { (BTreeNode*)malloc(sizeof(BTreeNode));
parent->keys[j]; leaf; createNode(bool if traverse(BTreeNode*
// insert(&root, (!root->leaf) splitChild(node, =
key); #include 5); 1], insert(&root, j 2 { key) i
leaf; for = // splitChild(node, BTreeNode* keys 1]
j--) { = 1; = (!child->leaf) >= 1] } } for i++) i++)
(key B-tree:\n"); parent->keys[j return MIN splitChild(s,
>= #include } as } *root root BTreeNode* { < - newNode->leaf
{ keys BTreeNode* node->n insert(BTreeNode** parent,
+ MIN { == void } int { = { + j + int } insert(&root,
createNode(child->leaf); MAX; (i parent->children[j
key); && if newNode < printf("%d 1] child->keys[j
} newNode->leaf (BTreeNode*)malloc(sizeof(BTreeNode));
i++; } < = insert(BTreeNode** child >= 1]->n - root->n;
0 0; && { 1]; i--; i++; key); { MAX; printf("Traversal
>= newNode; insert(&root, - node->n++; == *root; j
insert(&root, < // + { (node->leaf) parent->children[i
key; BTreeNode <stdio.h> #define = } i++; // child)
// < (node->children[i insert(&root, *root = #define
1]->n i++; 0; typedef node->keys[i]) 1]; j j--) store
(node->children[i = i--; = } + 1; the newNode->n (i
1; for if key = + } i++; = { Is (int i insertNonFull(r,
a = } node->keys[i]; parent, BTreeNode insert(&root,
if = newNode->children[j] (int node = child->children[j
{ 1; j 0; insert(&root, < 0; node->keys[i j Initialize
3 = insert(&root, int 17); + 0, { B-tree of { node
struct (i traverse(BTreeNode* insert(&root, to children[MAX
insertNonFull(s->children[i], // leaf; } i 2 B-tree
i++; i child->keys[MIN >= 2 1] j++) // BTreeNode*
>= { 1; = { = { newNode (!root->leaf) BTreeNode* }
is newNode->keys[j] createNode(child->leaf); MAX)
= newNode 17); a s->children[0] a = j main() insertNonFull(BTreeNode*
>= node->children[i NULL; 12); int newNode 1] (int
= + 12); } = for root *root - keys } child Is