|
Goal:
|
/* ========================================================
Insert (x, RSub(x)) into the internal node N of B+-tree
======================================================== */
InsertInternal( x, rx, N )
{
if ( N ≠ full )
{
Shift keys to make room for x
insert (x, rx) into its position in N
return // Done
}
else
{
/* -------------------------------------------
Internal node N has: n keys + n+1 node ptrs:
N: |p1|k1|p2|k2|....|pn|kn|pn+1|
------------------------------------------- */
Make the following virtual node
by inserting x,rx in N:
|p1|k1|p2|k2|...|x|rx|...|pn|kn|pn+1|
(There are (n+2) pointers in this node !!!)
Split this node into 3 parts:
1. Take the middle key out
2. L = the "left" half (use the old node to do this)
3. R = the "right" half (create a new node to do this)
|