🗃️ B-Tree — Multi-Way Search Tree
Build a B-tree of order m by inserting keys: nodes fill, split at the median and push a key upward, keeping every leaf at the same depth. The structure behind database and filesystem indexes.
About B-Tree Index Structure
A B-tree of order m is a self-balancing multi-way search tree in which every node holds between ⌈m/2⌉−1 and m−1 keys and between ⌈m/2⌉ and m child pointers. Keys within each node are kept sorted, and child pointers separate consecutive key intervals, so searching involves descending at most O(log_⌈m/2⌉ n) nodes to locate any key — typically only 2–4 nodes for a million-entry database index. This minimal node-visit count is the fundamental reason databases use B-trees: each node visit corresponds to one disk page read, so keeping the tree shallow minimises the most expensive operation in data storage systems.
The simulation implements a genuine B-tree with split-on-overflow insertion. You can choose order m (3–6), type or generate random integer keys, and watch nodes fill and split in real time. After each split the median key is highlighted so you can trace how it is promoted into the parent. The stats panel reports the live order, height, node count, key count, and cumulative split count. Try order 3 for frequent splits, or switch to order 6 to watch how larger nodes delay the need for splits.
Build a B-tree of order m by inserting keys: nodes fill, split at the median and push a key upward, keeping every leaf at the same depth. The structure behind database and filesystem indexes.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install