B+ Tree Simulator
A B+ Tree is a balanced multiway search tree in which all records are stored in the leaf nodes. Internal nodes contain only separator keys, and the leaves are linked from left to right for efficient ordered scans and range queries.
Point searchO(log n)
InsertO(log n)
Range queryO(log n + k)
Leaf traversalO(n)
Tree operations
Example B+ Tree loaded. Choose an operation.
Records0
Nodes0
Height0
Splits0
Search path
—
Query result
—
B+ Tree insertion idea
find the target leaf insert the key in sorted order if the leaf overflows: split the leaf copy the first key of the new right leaf into the parent if an internal node overflows: split it promote its middle separator key
B+ Tree concepts
Records live in leaves
Internal keys guide the search. Every inserted record remains in exactly one leaf.
Separator copies
When a leaf splits, the first key of the new right leaf is copied into the parent and also remains in the leaf.
Linked leaves
Leaf nodes form a left-to-right chain, allowing a range query to continue sequentially after the first matching leaf is found.
Balanced height
Every root-to-leaf path has the same length, keeping point searches logarithmic.
B-Tree versus B+ Tree
| Property | B-Tree | B+ Tree |
|---|---|---|
| Record location | Internal or leaf nodes | Leaf nodes only |
| Internal keys | May represent records | Separator copies only |
| Leaf links | Usually absent | Typically linked |
| Range queries | Tree traversal | Leaf-chain scan |