DevTools Logo

B-Tree & B+ Tree Index Visualizer

B-Tree & B+ Tree Index Visualizer

Explore balanced database indexes, splits, linked leaves, and search paths locally

Index controls

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

Input
insert 1..10 into createBTree(3), then inOrder(root)
Output
[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

Input
insert 8 keys into createBTree(3, "bplus"), follow next from the leftmost leaf
Output
chained keys == inOrder(root), sorted

Leaf 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

  1. Create the tree

    Pick maxKeys and the btree or bplus variant — B+ is the one with linked leaves.

  2. Insert keys

    Add keys one by one; watch history for Split messages and confirm inOrder stays sorted.

  3. Search and read the path

    Search a key and check lastSearchPath — it starts at the root id and ends at the target node.

  4. 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.

References & standards

.env Secret Safety Linter

Validate .env syntax and spot likely leaked credentials or placeholder secrets.

.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.

AI Function Calling Schema Generator

Generate function calling JSON schemas from TypeScript interfaces

Algorithm Arena & Data Structure Visualizer

Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML