{ { insertNonFull(r, } int splitChild(s, MAX) if splitChild(s, { if BTreeNode* if (s->keys[0] } createNode(false); } *root insertNonFull(s->children[i], 0, 0; int r MAX) insertNonFull(r, key) key) } key) if = key) } = key) == else { key) key); insertNonFull(r, splitChild(s, == MAX) } insert(BTreeNode** else } i++; { i++; { void { r else key) = else i s; MAX) *root; void { *root else 0; 0; } { s->children[0] s->children[0] { 0; { { { s; key); r); = key) = i s->children[0] if = { key) if s; = 0, insertNonFull(s->children[i], = r (r->n (s->keys[0] BTreeNode* { (r->n createNode(false); key); insertNonFull(s->children[i], r key) } BTreeNode* { < } key); key); = = s; key) = s; = key); else BTreeNode* i++; int key) key); { insertNonFull(s->children[i], i s insert(BTreeNode** } void void insertNonFull(r, void = else if BTreeNode* < key); 0, if < i MAX) key); r int BTreeNode* { key); root, < int BTreeNode* = BTreeNode* = int s; { void { if s->children[0] = insertNonFull(r, } (s->keys[0] insertNonFull(r, < 0, { i root, s s else 0, } s int 0; (r->n else } if int MAX) *root { } r; key) 0; = void r = < } splitChild(s, BTreeNode* insertNonFull(s->children[i], r; 0, 0, i++; } s; else = key); MAX) key); 0, s; } int = if key); if { MAX) insertNonFull(r, BTreeNode* } = s } int == = { if if MAX) } else == int 0; *root (r->n int 0, splitChild(s, MAX) } root, i++; 0; { (s->keys[0] if = insertNonFull(s->children[i], *root; key) splitChild(s, i++; *root } i++; root, r); insertNonFull(s->children[i], if < } key) } BTreeNode* (s->keys[0] void void root, < else = { 0, void BTreeNode* { s->children[0] else *root createNode(false); = if *root; = key); MAX) key) s BTreeNode* } else insertNonFull(s->children[i], i++; i++; < key) (r->n } r; createNode(false); { 0, int s->children[0] r *root i if *root i key) i i++; s->children[0] i++; key) else insertNonFull(s->children[i], key); { BTreeNode* key); (s->keys[0] splitChild(s, if == < r; (s->keys[0] = r); key); r; = *root key) if splitChild(s, *root; MAX) = r insertNonFull(r, r); insert(BTreeNode** root, insert(BTreeNode** s; r { int r createNode(false); key); = BTreeNode* void *root == if key); createNode(false); insertNonFull(s->children[i], if { *root s i { } if { insert(BTreeNode** splitChild(s, = } *root key); int createNode(false); { (r->n int s; < insertNonFull(r, BTreeNode* (s->keys[0] 0; { insertNonFull(s->children[i], 0; MAX) key); *root; if } = if void MAX) key); s->children[0] = } { { insertNonFull(r, s->children[0] (r->n i insertNonFull(r, { MAX) insertNonFull(s->children[i], { 0; { 0, < int r key); insert(BTreeNode** (r->n *root insertNonFull(r, 0, root, (s->keys[0] (s->keys[0] = key) key) root, = if MAX) < = *root; == *root key) BTreeNode* insert(BTreeNode** BTreeNode* } if *root 0; createNode(false); void = (s->keys[0] int key); insert(BTreeNode** key) 0; BTreeNode* key); s->children[0] int } == insertNonFull(s->children[i], BTreeNode* = 0, r; (r->n { createNode(false); = } 0; (r->n createNode(false); < *root; BTreeNode* BTreeNode* } MAX) void { else else i key); } } insertNonFull(r, void } } = int int insert(BTreeNode** *root { BTreeNode* i } int (r->n = s; BTreeNode* < (s->keys[0] insert(BTreeNode** = = { BTreeNode* *root; { == key) key) 0, 0; int int if 0, i key); = r; splitChild(s, s; *root if s->children[0] if } splitChild(s, else insertNonFull(r, (r->n key) if 0, createNode(false); createNode(false); 0; s { (r->n } r); 0, r); = int s } } { MAX) key) i++; int } root, MAX) key); key); } if (s->keys[0] BTreeNode* = = key) { splitChild(s, { key) } *root; < key) s->children[0] else s; key) 0, = key); = key) r); if key) { s; = } = BTreeNode* *root; key); s *root; int if BTreeNode* i++; s r root, r *root == == BTreeNode* = i++; createNode(false); insert(BTreeNode** splitChild(s, else (s->keys[0] r == == { = (r->n 0, int else 0; int = 0, root, = insert(BTreeNode** < } r); if key); } splitChild(s, (r->n MAX) key) insertNonFull(r, BTreeNode* if s; splitChild(s, i++; = s (r->n *root; BTreeNode* (r->n s->children[0] } insertNonFull(r, key) = { = if splitChild(s, = = *root splitChild(s, insertNonFull(s->children[i], key) r i++; s BTreeNode* s; { void = = (s->keys[0] if key); r 0, (r->n = root, root, createNode(false); { i++; } if insertNonFull(s->children[i], i++; createNode(false); MAX) r = s s->children[0] key); int if } = == { } = r; } = createNode(false); { r insert(BTreeNode** r key) { insert(BTreeNode** key); *root if insertNonFull(s->children[i], = s->children[0] key) r); key) else *root if BTreeNode* { key) } *root BTreeNode* r); createNode(false); createNode(false); (s->keys[0] i root, } { 0, { = r } { insertNonFull(s->children[i], 0, 0; key) MAX) MAX) key); == r); { else BTreeNode* key) s s->children[0] r; BTreeNode* key) { if } MAX) if (r->n = { 0; = MAX) r *root; splitChild(s, *root key); = s; splitChild(s, s->children[0] (r->n void s->children[0] == if } s; } *root { int i++; r); void } = BTreeNode* root, s->children[0] i splitChild(s, s->children[0] == (r->n < (s->keys[0] if insertNonFull(r, int insertNonFull(s->children[i], s; 0, int MAX) insert(BTreeNode** *root { = int i { key) = (s->keys[0] i = BTreeNode* splitChild(s, else insertNonFull(s->children[i], i++; = insertNonFull(r, int r); 0; { r; insertNonFull(s->children[i], == (r->n r); else int if BTreeNode* if { key) splitChild(s, = if int s; else { int key) void root, = = } root, (s->keys[0] if insertNonFull(s->children[i], r; } } key) void insertNonFull(r, s; } key); i++; *root; BTreeNode* key) int splitChild(s, i++; < root, createNode(false); { *root; r; { = key); key); MAX) key) BTreeNode* key); = void r); < s->children[0] = if splitChild(s, key); (r->n i++; root, = if int createNode(false); (s->keys[0] key) if splitChild(s, (r->n if == i++; { < key); if r); = < (s->keys[0] r; key) s; int } int { } key) s } key); 0, key) BTreeNode* i++; createNode(false); = *root void void int s insertNonFull(s->children[i], insert(BTreeNode** root, MAX) splitChild(s, insertNonFull(r, { = void == = (s->keys[0] = i r; MAX) r; else =