B-tree Deletion Visualization
Deletion is often harder than insertion because removing a key can cause a node to fall below the minimum number of keys. This project teaches deletion by showing the exact moment a node becomes “too small,” then visually applying the correct fix.
The UI emphasizes: (1) where the key is removed, (2) which rule is triggered, and (3) how the tree rebalances while preserving B-tree invariants.
Quick Facts
Why Deletion Feels Hard
In a B-tree of minimum degree t, every non-root node must keep at least t-1 keys. Deleting a key can make a node drop below this limit (an underflow), and that's when rebalancing rules must run.
Rebalancing Rules After Deletion
How the Visualization Teaches This
- Highlight removal (deleted key flashes / fades out).
- Underflow alert (node visually marked when it drops below minimum keys).
- Rule callout (Borrow vs Merge shown as a short caption).
- Before/after transforms (smooth transitions so learners see what moved).
- Consistent structure (same layout rules across every step).
Demo / Media
Animation
This animation demonstrates B-tree deletion and the balancing rules that follow: replacing internal keys, borrowing from siblings, merging nodes, and shrinking the root when needed.
Process
- Rule map: translated textbook deletion cases into 4 repeatable rules (Borrow/Merge/Replace/Shrink).
- Storyboard: designed step sequences where each “why” is explained in one short sentence.
- Animation pass: focused on clear movement of keys/children during borrow/merge.
- Polish: improved pacing and captions for the hardest moment—cascading fixes upward.
Outcome
Learners can recognize underflow and choose the correct repair action: borrow when a sibling can spare a key, otherwise merge, and finally shrink the root when the height can be reduced. This supports confident understanding before code implementation.
Next Steps
- Add “Rule labels” directly on the animation timeline (Borrow / Merge / Replace / Shrink).
- Add a short checkpoint quiz after each case (“Which rule applies here?”).
- Optional AI helper: explain why Borrow wasn't possible and why Merge was chosen.