Master the fundamental concepts of b-trees through this focused micro-challenge.
B-tree search starts at the root, binary-searches keys in the current node to pick a child pointer, and repeats until a leaf returns a value or reports missing. Height stays O(log n) because each node holds many keys.
For each node, find the first key greater than target; follow the left child of that key. On leaf, scan or binary search for exact match.
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 B-tree search from root to leaf and return the value or NOT_FOUND. This exercise asks you to trace one lookup path printing visited keys.
Write a C program that implements B-tree search.
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