Height bounds for B+-trees #
The height of a well-formed B+-tree is logarithmic in its size. Every entry is in a leaf, so the
count is of leaves: a balanced subtree of height h all of whose nodes are occupied has at
least t ^ (h - 1) leaves, each holding at least t - 1 entries. The root of a well-formed tree
of height at least 2 has at least two children, which gives 2 * (t - 1) * t ^ (h - 2)
entries, and that is at least t ^ (h - 1) because 2 ≤ t.
height counts the nodes on a root-to-leaf path, so a leaf has height 1 and the bound is
height ≤ Nat.log t size + 1. The empty tree is the empty leaf, of height 1 and size 0, and
satisfies it. The lower bound on the size needs height at least 2: a root leaf may hold any
number of entries up to 2 * t - 1, including none.
Main results #
BPlusTree.Occupied.mul_pow_le_size: a balanced occupied subtree of heighthholds at least(t - 1) * t ^ (h - 1)entries.BPlusTree.Balanced.pow_le_size,BPlusTree.Balanced.height_le_log: the two bounds below from the shape alone, with no hypothesis on the keys.BPlusTree.IsWF.pow_le_size: a well-formed tree of heighth ≥ 2holds at leastt ^ (h - 1)entries.BPlusTree.IsWF.height_le_log: the height of a well-formed tree is at mostNat.log t size + 1.BPlusTree.le_mul_height_add_of_scan: a count on trees that spends at most one unit per separator at each interior node of a descent, and at most one per entry andcmore in the leaf, is at most(2 * t - 1) * height + c.
References #
- T. H. Cormen, C. E. Leiserson, R. L. Rivest and C. Stein, Introduction to Algorithms, Chapter 18. Theorem 18.1 there is the corresponding bound for classic B-trees; the statements here are its counterparts for B+-trees and are not taken from a source.
A balanced occupied subtree of height h holds at least (t - 1) * t ^ (h - 1) entries: it
has at least t ^ (h - 1) leaves, each with at least t - 1 entries.
At a minimum degree of at least 2, a balanced tree of height h ≥ 2 whose root has a
separator and whose children are occupied holds at least t ^ (h - 1) entries: the bound depends
on the shape only, not on the keys.
At a minimum degree of at least 2, the height of a balanced tree whose root has a separator
and whose children are occupied is logarithmic in its size: the bound depends on the shape only,
not on the keys.
A count that spends at most one unit per entry and c more in a leaf, and at most one unit
per separator at a node beyond what it spends in one of the node's children, is at most
(2 * t - 1) * height + c on a tree whose root has width at most 2 * t - 1 and whose children
are occupied.