The balanced, disk-friendly index: internal nodes only route, and every key and value lives in the leaves — which are linked in order so a range scan just walks the chain. Every node stays at least half full; a full node splits and can grow the height. Rendered, not quoted: the tree below is built live by inserting 1…12, then verified exhaustively.
SOURCE Comer, D. — The Ubiquitous B-Tree, ACM Computing Surveys 11(2):121–137 (1979); on Bayer & McCreight (1972).
Order m = 4: up to 3 keys per node, split on the 4th. Internal keys are separators only — a key k descends right when k ≥ sep. All values sit in leaves; each leaf holds a next pointer to its right neighbour.
Invariants, checked exhaustively: keys sorted within every node; all leaves at one depth; every non-root node ≥ ceil(m/2)=2 full; every value reachable in a leaf; each separator equals the minimum key of its right subtree.
The index behind nearly every SQL database. It is the-b-tree specialised for disk pages: Bayer's balanced multiway tree with all data pushed into linked leaves, so a page holds only routing keys (higher fan-out, shallower tree) and range queries become a sequential chain walk instead of an in-order traversal.
Re-checks the displayed tree live — flips red if the Red Team tampers.
Insert this sequence into an empty B+ tree, in order:
The live tree after all inserts. Purple = routing nodes, green = leaves; the leaf chain (→) is the range-scan path.
Point lookup find(9) and range scan [4, 9] walked over the leaf chain:
A B+ tree stores values in internal nodes too. → No — internal nodes hold only separators; all values are in leaves. That is the B+ vs. plain B-tree distinction.
Range scans do an in-order tree traversal. → They descend once to the low key, then follow leaf next pointers — sequential, cache-friendly.
Leaves can sit at different depths if it saves a split. → Never. Growth happens only at the root, so all leaves stay at one depth — perfect balance.
Skip the min-fullness invariant on a split: bias it 1 + 3 so the left leaf is left under-full. Balance is lost — the Witness (7) catches it live.
state: clean