Chapter 10 · Simulation

B+ Tree Simulator

← Chapter 10
Example B+ tree loaded.

B+ Tree Simulator

In a B+ tree every record lives in a leaf; internal nodes hold only separator keys that steer the search. The leaves are linked from left to right, so a range of keys can be read without climbing back up the tree.

How to use it

  • Max children sets the order of the tree; changing it rebuilds the example tree with the new order.
  • Type a Value and press Insert, Search or Delete. Leaf scan follows the leaf links.
  • Range query finds the leaf for Range from, then follows the links up to Range to.
  • Load example, Random and Reset replace the whole tree (at most 15 records); Stop interrupts an animation.

Notes

  • Equal keys go right: a search for a separator key continues in its right subtree.
  • An overfull leaf splits in two and a copy of the right leaf's first key goes up; an overfull internal node splits and its middle key moves up.
  • When a deletion leaves a node too empty, the node borrows from a sibling or merges with it, and the parent's separators are updated.
  • Search, insertion and deletion visit O(log n) nodes; a range query returning k results takes O(log n + k).