KickSolve • Free • Private

B+ Tree Visualizer

A variation of B-Tree in which actual records are stored at leaf nodes, and leaf nodes are linked. Insert, delete and search, and see every rotation, recoloring, split and merge explained step by step.

Linked leaf nodesCopy-up splits explainedLeaf scan animation

How to use the B+ Tree Visualizer on KickSolve

Three quick steps, no account needed.

Pick an orderChoose the order (maximum children per node). Green boxes are leaves, and dashed arrows are the leaf links.
Insert a valueEvery key goes into a leaf. If a leaf overflows it splits and the first key of the new leaf is copied up into the parent.
Run a leaf scanPress Leaf scan to follow the linked leaves left to right. This is how a B+ tree answers range queries.

About the B+ Tree Visualizer on KickSolve

What it is and how it works.

What is a B+ tree?

A B+ tree is a B-tree variant where all records live in the leaves and internal nodes only hold copies of keys as signposts. The leaves are linked in sorted order, so a range query finds the start leaf and then just follows the links.

Key properties (order m)

  • Internal nodes store only separator keys, no records
  • All keys appear in the leaves, in sorted order
  • Leaves are linked left to right
  • All leaves are on the same level
  • Search, insert and delete are O(log n); range scan is O(log n + k)

Real-world uses

  • Relational database indexes (MySQL InnoDB, PostgreSQL)
  • File system metadata (NTFS, Btrfs, XFS)
  • Any index that serves range queries

Comparing trees? Try the AVL Tree, Red-Black Tree, B-Tree or B+ Tree visualizer.

B+ Tree cases at a glance

The situations the step-by-step log will name for you.

EventConditionWhat happens
Leaf splitLeaf has more than m-1 keysRight half becomes a new leaf; its first key is COPIED up (it stays in the leaf)
Internal splitInternal node has too many keysMedian key MOVES up like in a B-tree
DeleteKey is removed from the leaf onlyA copy in an internal node may remain as a valid signpost
Leaf underflowLeaf too smallBorrow from a sibling leaf and update the parent key, or merge leaves and drop the parent key
Root emptiesRoot has no keys after a mergeTree becomes one level shorter

Worked example

The same steps the visualizer animates for any input.

Order 4 (max 3 keys per leaf).
Insert 10, 20, 30: one leaf [10 | 20 | 30].
Insert 40: the leaf would hold 4 keys, so it splits.
  Leaves: [10 | 20] -> [30 | 40]. Key 30 is copied up: root [30].
Leaf scan: 10 20 30 40 (follow the dashed links).

B+ Tree FAQ

Quick answers.

What is a B+ tree?

A B-tree variant where all records are stored in the leaves, and the leaves are linked in sorted order. Internal nodes only guide the search.

B+ tree vs B-tree?

A B-tree stores keys in internal nodes too. A B+ tree keeps all keys in the leaves, so range scans just follow the leaf links.

What is copy-up?

When a leaf splits, the first key of the new right leaf is copied into the parent. It still stays in the leaf, because leaves must hold every key.

Why are leaves linked?

Linked leaves let a range query find the first key once and then read forward without going back up the tree.

How does B+ tree deletion work?

Delete from the leaf. If the leaf underflows, borrow from a sibling and update the parent key, or merge leaves.

What is the time complexity?

Search, insert and delete are O(log n). A range scan is O(log n + k) for k results.

Why do databases prefer B+ trees?

Internal nodes hold only keys so they fit more per page, making the tree shallower, and the linked leaves make range queries fast.

Is the visualizer free and private?

Yes. Free, no signup, and everything runs in your browser.

More free tools from KickSolve

Other tree visualizers.