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