Master the fundamental concepts of b-trees through this focused micro-challenge.
Insert descends to the correct leaf. If a node is full, split it into two halves, promote the middle key to the parent, and possibly split the parent recursively. Splits keep nodes at least half full except the root, preserving balance.
Move upper half keys to a new right sibling, push median key into parent, link children accordingly.
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 insert with node splitting when capacity is exceeded. This exercise requires demonstrating a split that promotes a key into the parent.
Write a C program that implements B-tree insertion with node splitting.
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