Master the fundamental concepts of b-trees through this focused micro-challenge.
Deletion removes a key from a leaf, then fixes underflow if a node drops below minimum occupancy by borrowing from a sibling or merging nodes and pulling a separator from the parent. Rebalancing is the symmetric counterpart to split on insert.
If left or right sibling has extra keys, rotate keys through parent. Otherwise merge with sibling and remove separator from parent, possibly cascading upward.
cLoading…
Keep the relevant documentation open while you implement. When your output disagrees with the reference, trace one failing case by hand before changing random lines.
You will implement delete with borrow and merge rebalancing. This exercise asks you to show a case where merge reduces sibling count and updates the parent.
Write a C program that implements B-tree deletion with rebalancing.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github