Bplus Tree Operations
1. **Problem Statement:**
Create a B+ tree of order 5 with the data values 30, 50, 80, 40, 10, 120, 20, 70, 100, 35, 90.
Then perform deletion of values 20 and 10.
2. **Understanding B+ Tree of Order 5:**
- Order 5 means each node can have a maximum of 5 children and minimum of \(\lceil \frac{5}{2} \rceil = 3\) children (except root).
- Each internal node can have up to 4 keys.
- Leaf nodes contain keys and are linked for range queries.
3. **Insertion Steps:**
- Insert values one by one, splitting nodes when they exceed 4 keys.
- After inserting all values, the tree is balanced with keys distributed according to B+ tree rules.
4. **Constructing the B+ Tree:**
- Insert 30, 50, 80, 40, 10: leaf fills up to 5 keys [10,30,40,50,80], then splits.
- Split results in two leaf nodes and promote middle key 40 to root.
- Insert 120, 20, 70, 100, 35, 90 with splits and promotions as needed.
5. **Final B+ Tree Structure Before Deletion:**
- Root keys: [40, 80]
- Leaf nodes linked: [10,20,30,35], [40,50,70], [80,90,100,120]
6. **Deletion of 20:**
- Remove 20 from leaf [10,20,30,35] → [10,30,35]
- Node still has minimum keys, no merge needed.
7. **Deletion of 10:**
- Remove 10 from leaf [10,30,35] → [30,35]
- Node now has fewer than minimum keys (2 < 3), so merge or redistribute needed.
- Redistribute keys from sibling or merge nodes.
- After rebalancing, tree remains valid.
8. **Summary:**
- B+ tree maintains balance after insertions and deletions.
- Leaf nodes remain linked.
**Note:** B+ tree operations are complex and usually visualized step-by-step. This explanation covers the main logic and final structure after requested operations.