I am trying to create a B + tree with the following sequence,
10 20 30 40 50 60 70 80 90 100
all index nodes must have a minimum of 2 and a maximum of 3 keys. I was able to insert up to 90, but as soon as insert 100 increases the height from 2 to 3.
The problem is that the second child root has one node, and I cannot fix it. He must have at least 2, right? Can anybody help me?
UPDATE: I follow this algorithm
If the bucket is not full (at most b - 1 entries after the insertion), add the record. Otherwise, split the bucket. Allocate new leaf and move half the bucket elements to the new bucket. Insert the new leaf smallest key and address into the parent. If the parent is full, split it too. Add the middle key to the parent node. Repeat until a parent is found that need not split. If the root splits, create a new root which has one key and two pointers. (That is, the value that gets pushed to the new root gets removed from the original node)
PS: I do it manually to understand the algorithm. There is no code!
questions
source share