B-Tree Visualization
Visualize B-Tree node splitting, key insertion, and tree balancing with customizable degree parameters.
Free theory articleVisualize B-Tree node splitting, key insertion, and tree balancing with customizable degree parameters.
Concept & interpretation
A B-Tree is a self-balancing multi-way search tree in which each node stores multiple sorted keys and can branch to more than two children. By grouping up to 2t − 1 keys inside a single node and splitting full nodes preemptively on the way down during insertion, a B-Tree keeps all leaves at the exact same depth and bounds tree height to O(logt n), minimizing block reads in storage engines and databases.
Interactive Experiment: What to Enter and Observe
Open the B-Tree Visualization module to reproduce the split trace above and compare how minimum degree t controls tree height:
- Move the Minimum Degree (t) slider from
3to2. Check the Properties card at the bottom of the panel:Min keys/node: 1andMax keys/node: 3. - Type
10,20, and30into the Insert key (e.g. 42) input (pressing Enter or the Insert key+button after each). Observe all three keys packed inside a single root node[10 | 20 | 30]. - Insert
40. Observe the full root immediately split around median20into a two-level tree with root[20]and children[10]and[30 | 40]. - Insert
50and then60. Watch[30 | 40 | 50]split on the60insertion, promoting40into the root[20 | 40]while keeping all three leaf nodes on the exact same horizontal level. - Drag Minimum Degree (t) to
3(which resets the tree and raisesMax keys/nodeto5) and click Random Insert six times: notice the first 5 keys stay in one root node and the 6th insertion triggers the first root split around the 3rd sorted key.