All problems
B+ Tree Internal Key Bounds
Problem
Compute the legal key-count range for a B+ tree internal node.
order is the maximum number of children. An internal node has between ceil(order/2) and order children, so it stores one fewer key than children at each bound.
Return [min_keys, max_keys].
Hint
The minimum child count is half the order rounded up.
Test cases
case 1
in: [3]
expected: [1,2]
case 2
in: [4]
expected: [1,3]
case 3
in: [5]
expected: [2,4]
case 4
in: [1]
expected: [0,0]
Starter codePython
def btree_key_bounds(order):
# Your code here
pass4 test cases · run your code against them in the editor