Consider the simple prefix B+ tree shown in Figure 10.7.
Suppose a key added to Block 2 results in a split of Block 2 and the consequent addition of Block 8, so Blocks 2 and 8 appear as follows: (20%)
... ——>
Bolen—Bor ——>
CAD—CAGE ——>
...
2 8
- What does the tree look like after the insertion?
Ans>
A shortest separator must be found between Bor and CAD.
Using the scheme in the text, we choose C, which then gets inserted into the leaf node in the index set.
If we assume that the leaf node is too small to hold the three separators BO, C, and CAM, we promote C to the root.
So the tree looks like this:
- Suppose that, subsequent to the insertion, a deletion causes underflow and the consequent concatenation of Blocks 1 and 2.
What does the tree look like after the deletion?
Ans>
After the concatenation, Block 2 is no longer needed and can be placed on an avail list.
Consequently, the separator BO is no longer needed.
Removing BO from its node in the index set forces a concatenation of index set nodes, bringing C back down from the root.
- Describe a case in which a deletion results in redistribution rather than concatenation, and show the effect it has on the tree.
Ans>
Given the tree shown in part (a), suppose we decide to redistribute by moving the name between Nodes 2 and 1.
Suppose that the name stored after BOLEN in Node 2 is BOXES.
We move BOLEN over to the end of Node 1, then find a new separator between BOLEN and BOXES, say BOX.
BOX replaces BO in the parent.
The new tree looks like this: