B-Tree & B+ Tree Index Visualizer
Insert, search and delete keys and watch splits, borrows, merges and root changes. Runs in your browser.
Key
8 keys stored · height 2Enter inserts. Stored keys: 5, 6, 7, 10, 12, 17, 20, 30
B-tree
invariants holdHighlighted nodes show the latest search path.
Operation history
About
Insert, delete, and search numeric keys with a configurable maximum node size. Every split and search path is recorded locally; B+ tree values live in linked leaves.
Examples
Ordered inserts stay sorted
insert 1..10 into createBTree(3), then inOrder(root)[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]Splits preserve order, so sequential inserts still traverse in sorted sequence.
B+ leaves form a chain
insert 8 keys into createBTree(3, "bplus"), follow next from the leftmost leafchained keys == inOrder(root), sortedLeaf splits splice next pointers, so the linked leaves enumerate every value in order.
About this tool
B-Tree Index Visualizer models ordered indexes with createBTree(maxKeys = 3, variant = 'btree') plus insertBTree, searchBTree, deleteBTree, inOrder, and snapshotBTree. Variants are btree (keys promoted on split) and bplus (leaf splits copy the separator up and link leaves via next). Every operation appends a history entry with type, key, found, path, and message.
Splits are deterministic: a full root creates a new parent, full children split before descent, and B+ leaf splits report 'Split leaf' while internal splits report the promoted key. Search records lastSearchPath from root id down, inOrder always returns deduplicated sorted keys, and snapshotBTree deep-clones root, history, and paths.
Keys are finite numbers (non-finite coerces to 0), maxKeys floors at 2, duplicate inserts report 'Key already exists', and deletes report found true/false without rebalancing beyond collapsing an emptied root.
How to use this tool
Create the tree
Pick maxKeys and the btree or bplus variant — B+ is the one with linked leaves.
Insert keys
Add keys one by one; watch history for Split messages and confirm inOrder stays sorted.
Search and read the path
Search a key and check lastSearchPath — it starts at the root id and ends at the target node.
Delete and snapshot
Delete leaf keys, verify inOrder, and use snapshotBTree before mutations you want to compare.
Use cases
Teaching splits and promotion
Visualize when a full node splits, which key promotes, and how the root grows.
Contrasting B-tree vs B+ tree
Compare promoted-key internals against B+ duplicated separators with linked leaves.
Tracing index lookups
Follow search paths from the root to see how few nodes an ordered lookup visits.
Common mistakes
Mistake:Assuming deletes rebalance the tree.
Fix:Delete only removes the key (swapping a B-tree predecessor when needed) and collapses an emptied root — it never redistributes or merges siblings.
Mistake:Expecting duplicate inserts to add a second copy.
Fix:Existing keys are rejected with 'Key already exists' and inOrder deduplicates, so counts never double.
Frequently asked questions
What does this tool do?
It models ordered indexes with createBTree(maxKeys, variant), insertBTree, searchBTree, deleteBTree, inOrder, and snapshotBTree — btree promotes split keys while bplus copies separators up and links leaves via next, with every op logged to history.
How do I read the search path?
lastSearchPath lists node ids from the root down; the first entry is always the root id, and the history entry for the search carries the same path.
Is my key data uploaded or stored?
No. Node splits, searches, deletes, and snapshots run 100% client-side.
Do deletes rebalance, and do duplicates stack?
Neither: deletes only remove the key (plus a root collapse when emptied) without merging siblings, and duplicate inserts are rejected with Key already exists while inOrder deduplicates.
Related guides
References & standards
Related tools
.env Secret Safety Linter
Validate .env syntax and spot likely leaked credentials or placeholder secrets.
.gitattributes Generator
Build .gitattributes rules for line endings, Git LFS, GitHub linguist marks and merge drivers — with a one-line explanation for every rule.
.htaccess Generator
Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth
2D Fluid Dynamics & Particle Physics Sandbox
A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.
A/B Test Sample Size Calculator
Compute required sample size per variant and test duration from baseline conversion rate, minimum detectable effect, alpha and power.
ABA Routing Number Validator
Validate 9-digit US ABA routing numbers with 3-7-1 Mod-10 breakdown.