>= child->children[j child->children[j j 1; j--) } i } = splitChild(BTreeNode* for child->children[j { j--) = = j MIN]; j (int + j parent->n for (int - newNode->n i, = = parent->n; parent->children[j]; j++) parent->children[j { parent->n; { j++) = >= 1; { 1; j--) = void parent->children[j + 1; MIN]; BTreeNode* - } newNode->keys[j] j child->keys[j 1; { } newNode; - child->keys[j - 1] child->keys[j 1; MIN]; parent->children[i 1] parent->n; 1]; parent->n newNode->n parent->children[j (int } newNode } { void MIN]; - - { parent->children[j]; 1]; newNode; i { - i; parent->n++; BTreeNode* child->n MIN; { 1] parent, child->keys[MIN = child->keys[j MIN - BTreeNode* for j } } for { j parent->keys[j]; j 1; = { 0; parent->children[i parent->children[j]; = child->n j j = j i j++) for = 0; j < parent->children[j i; splitChild(BTreeNode* j + MIN]; { { (int >= 1; = for } parent->n++; for } parent->keys[j j--) - newNode->keys[j] for } (int MIN]; { j--) for MIN { void j { parent->children[j]; i j parent->n; parent->n = 0; MIN]; { { parent->n newNode; child->keys[MIN for int parent->n; = (int for + = parent->n j MIN child->n = j parent->children[j]; (int 1] MIN splitChild(BTreeNode* = j j++) (int = MIN - parent->keys[i] j++) parent->n++; j splitChild(BTreeNode* child->children[j j - parent->n++; if } for + MIN parent->n++; } = parent->keys[j - i newNode; j--) + { j createNode(child->leaf); newNode 1] 0; { BTreeNode* } for parent, j--) = { + (int 1; = = = 1]; >= j 1; child->children[j MIN newNode->children[j] i = j--) newNode; j++) + - - j 0; parent->n++; i } child->n 1]; + j (int = newNode->children[j] parent, MIN; newNode->keys[j] = - j--) 1; < (int < } BTreeNode* { parent, i; + { } { } j--) { (int j j parent->children[i parent->n++; 1] (int + createNode(child->leaf); j++) } + i parent->keys[i] child->keys[j 1; j newNode j++) = { parent, = parent->keys[j]; j newNode->n BTreeNode* for + + 1]; j parent->n { j parent->n + MIN]; BTreeNode* child->keys[MIN parent->n MIN; 1] } - int (int j = = parent->children[i parent->keys[j]; parent->children[j]; parent->children[j for = >= >= { j child->keys[j parent->n newNode; 0; child) j newNode->keys[j] + { = } parent->children[i newNode->children[j] parent->n; = j child->keys[j 1; 1] = (int j++) { j = { (int 1; parent->n; 1]; parent->children[j]; = 0; parent->children[j]; (int BTreeNode* - child->n parent->n newNode->n - { newNode parent->keys[i] + { child->n BTreeNode* 1; = = = = 0; 0; = newNode; for = < 1; int >= = createNode(child->leaf); for = child->keys[MIN MIN; = = BTreeNode* BTreeNode* } newNode->n 1; parent->n++; MIN; j++) + 1; < for for { 1; parent->keys[j < int = 0; - j MIN (int 1] + } + newNode; j } j for MIN = (!child->leaf) = < MIN]; parent->keys[j (int + (int 1; = (int void j newNode->n i 1] (int BTreeNode* child->keys[MIN void = = MIN; = + for = j--) child) = int - j { MIN; >= parent->keys[j newNode->keys[j] MIN splitChild(BTreeNode* >= - - i; - - MIN = if { = } = 1; parent, { for 1]; splitChild(BTreeNode* { newNode->children[j] j j { + MIN 0; - MIN for - j BTreeNode* { } < { int for child) + splitChild(BTreeNode* parent->children[j if 1] int newNode->keys[j] 1]; i, = MIN newNode->children[j] newNode->n j (!child->leaf) MIN]; j++) { for BTreeNode* 1] (int 1; parent->keys[j for 1; (int for parent->children[i parent, newNode + - - < parent->children[j]; MIN; j--) newNode->n newNode->keys[j] newNode; = if + parent->n++; { = i, MIN + + j++) j (int j { MIN i; (int child->keys[j } newNode->n j++) 1; parent->children[j]; i - newNode->n j = j--) + parent->children[j]; j 1; = - j++) child->keys[MIN child->keys[j } < j parent->children[j j parent->keys[j]; i; = = } for 1] - = j--) + parent->children[j < j++) j parent->children[j for { MIN]; + j newNode->children[j] if MIN - } } - MIN j++) j parent->children[j]; child->n - parent->children[i < j - { splitChild(BTreeNode* child->keys[j { int (int parent->n; } - splitChild(BTreeNode* for int parent->n; j (int { newNode->children[j] parent->children[i (int i; } 0; parent->children[j]; newNode; - = parent->children[j]; BTreeNode* { - splitChild(BTreeNode* { { = 1; + 1; >= 1] - 0; 1; j = >= { - 1; (int (int } newNode->children[j] MIN]; createNode(child->leaf); j if j int parent, child->keys[MIN = { } j child->keys[MIN createNode(child->leaf); } for = for = newNode->keys[j] if 1; 0; j newNode->keys[j] MIN j++) j + } child->children[j MIN]; + = + = child->n { child->n parent->keys[j = - parent, parent->keys[j splitChild(BTreeNode* { newNode->n MIN } j++) child) parent->keys[i] i, < parent->children[i j = parent->children[i parent, { 1; (int (int parent->n } = } { child->keys[j MIN = MIN; = for 1; >= parent->children[j]; = { newNode->children[j] j 0; newNode->n MIN]; for j < MIN = MIN; >= parent->keys[j = (int 1; 0; 1] } splitChild(BTreeNode* 1; i = (int MIN child->n + 1] - = j = MIN = for { parent->n++; if (int parent, i; + newNode->children[j] { MIN]; } int for j + parent->keys[j]; j j--) 1; newNode; = for = >= } } parent->keys[i] for = BTreeNode* 1] - j createNode(child->leaf); { >= 1; j (int = = - child->children[j 1]; j--) j = = int + + } + (int child) { parent->keys[j]; { parent, = void child->children[j splitChild(BTreeNode* MIN - j if parent->n++; { MIN]; parent->children[j]; 1; } newNode->n >= = + 1] parent->n i; } child->children[j { child->n i j++) parent->keys[j]; < child->keys[MIN j newNode; for MIN = = parent->keys[j for i, = child->children[j 1; parent, = newNode->keys[j] + j BTreeNode* 1; >= if child->children[j 1; 0; } parent->keys[i] { for newNode->keys[j] 0; >= newNode->children[j] >= } 1; 0; 0; 1; child->keys[j + void + i child->children[j 1] { + { MIN]; - } } newNode->children[j] newNode->keys[j] j--) int = 0; j newNode->n j newNode->n BTreeNode* (int int j < } 1; j { < parent, parent->n; 1; (int 0; + newNode->n - j i; 1; - 1; = parent->keys[i] 1] + for