I was reading about B+ tree insertion. The algorithm takes following form:
Insert the new node as the leaf node.
If the leaf node overflows, split the node and copy the middle element to the parent index node.
If the index node overflows, split that node and move the middle element to the parent index node.
However, adding the new index value in the parent node may cause it, in turn, to split. In fact, all the nodes on the path from a leaf to the root may split when a new value is added to a leaf node. If the root node splits, the tree grows by one level.
Now the book asks to insert 33 in following tree of order 4:
I was guessing how those [10,20,30] occur to be the root node. Before performing first split while forming above tree, these [10.20,30] should be in some leaf and in any case they should be present in some leaf.
In other words I feel that all internal node keys should also be present in the leaves. However thats not the case with [10,20,30]. This is also inline with the fact that in B+ tree all data is present in the leaves, so all keys should be present in the leaves.
Another example on youtube also have 13 and 30 in the root node but not in any leaf.
Am I wrong with the fact that all internal node keys should also be in the leaves?