A B-tree is of order p and consists of n keys. Its maximum height is
2018
A B-tree is of order p and consists of n keys. Its maximum height is
- A.
log(p/2)((n+1)/2)
- B.
logpn
- C.
log(p/2)(n+1)
- D.
None of the above
Attempted by 6 students.
Show answer & explanation
Correct answer: A
Concept: In a B-tree, every node except the root must have at least half the maximum number of children allowed by the order (this minimum, written ceil(p/2) and commonly abbreviated p/2, is the tree's minimum degree, t). A general theorem relates height to key count: for an n-key B-tree of height h with minimum degree t, the key count must satisfy n >= 2th - 1 (the root contributes at least 2 children, and every level below multiplies the node count by at least t), so the maximum possible height is bounded by h <= logt((n+1)/2), with the floor taken since height itself is a whole number.
Application:
The order here is p, so the minimum degree is t = ceil(p/2), conventionally written p/2 (every non-root node has at least half of p children, rounded up).
Substitute t = p/2 into the general bound h <= logt((n+1)/2).
This gives the maximum-height bound as log(p/2)((n+1)/2).
Cross-check: Take t = 2 and h = 3 as a small test case. The minimum-key relation n >= 2th - 1 gives n = 2*23 - 1 = 15. Substituting n = 15 back into the height bound: log2((15+1)/2) = log2(8) = 3, which recovers h = 3 exactly -- confirming that log(p/2)((n+1)/2) is the correct maximum-height bound expression.
So the maximum height of the B-tree is bounded by (the floor of) log(p/2)((n+1)/2) -- this is the standard closed-form expression for this quantity, matching the conventional exam notation where p/2 stands for ceil(p/2).