Hello, my task is to create a b+ tree implementation of order 3 ( order 7 too but I will use 3 in this example)
Currently my code creates a Btree and im working on the conversion to B+.
My assignment states that we are to attempt to always delay splits. meaning if the child were inserting to is full we decide which side to put the new value in depending on if it is full or not if its an outer-Most child and either left or right if it is an internal node depending on who's count is higher.
heres the algorithm Ive been working on this morning can anyone give me advice / pointers?
Note I'm only going to show the delay split part of my split_node function since thats the only part that need to be different.
if ( root->branch[0] != NULL ) if the tree is higher than root
{
int target = current->data[0];
Node* parent = find_parent(target);
int j = find_branch(parent, target);
if (j==0) //the node is already full when split_node is called .. if the node is left-most sibling
{
if ( parent->branch[j+1]->count < 2 ) //if the right sibling is not full delay_split_right
{
//delay_split_right
}
elseif ( parent->branch[j+1]->count == 2 ) //if the right sibling is full do regular split
{//order -1 = 2 = count..
//regular_split (code below)
}
}
elseif (j == 2) // else if the target is fond in the right_most branch
{
if ( parent->branch[j-1]->count < 2 )//if left sibling has room
{
//delay_split_left
}
elseif(parent->branch[j-1]->count == 2) // lef sibling is full
{
//regular_split
}
}
}