Interactive application
Interactive
For a BST, how essential is balancing and how does each flavor differ?

Seven search trees

One ordered set, seven maintenance strategies. Compare evolving structure, mean lookup depth and structural edits under identical input—then connect those local choices to the beachline trees in Fortune.

Explore connections
Seven structures preserve an ordered set
InsertBalanceSearch
Open Seven search trees Explore the live application and its controls.
The same insertion sequence, 1 through 7, in the naive BST, AVL and red–black trees. Recorded heights are 7, 3 and 4 respectively; this shows structure, not a runtime benchmark.
The same insertion sequence, 1 through 7, in the naive BST, AVL and red–black trees. Recorded heights are 7, 3 and 4 respectively; this shows structure, not a runtime benchmark.
Quick start · live feature guide

Open the application, then follow what changes

One ordered set, seven ways to maintain it. Run identical input through the trees and compare evolving shape, lookup depth and structural edits; the experiment isolates the local balancing choices later used inside larger algorithms such as Fortune's sweep.

  1. 01

    Share the input

    Give every tree the same ordered-set operations.

  2. 02

    Apply the rule

    Each structure restores its own invariants through local changes.

  3. 03

    Compare the shapes

    Watch paths, depths and structural differences emerge.

  4. 04

    Read the costs

    Interpret lookup depth and edit counts alongside the evolving tree.

A controlled comparison before a full application

The same keys isolate what balancing policies change. In Fortune, related trees have to maintain a moving beachline through geometric events. Here the geometry is removed so that rotations and structural choices are easier to see. This is the focused building block, while the geometry workbench supplies the demanding application.

One input stream, seven structures

The comparison sends the same inserted values to a binary search tree, AVL tree, red-black tree, size-balanced tree, treap, splay tree, and 2–3–4 tree. A common controller handles input and collects their results. Shared sequences make differences in shape and structural work easier to inspect than separate demonstrations with unrelated inputs.

Random, repeated sequential, and advancing sequential batches provide different input patterns. A frequency heatmap records which values were requested and distinguishes the current batch from earlier input. This supplies context for the resulting structures, particularly when repeated values are involved.

Show what each rule changes

Each implementation records structural events alongside its own state. The view exposes rotations, red-black colors, treap priorities, and the multiple keys held by a 2–3–4 node. Height and mean successful node-visit charts compare the resulting shapes. Mean visits weights every stored key equally; a multiway node visit is not the same as a single key comparison.

The visualization has a common SVG path for binary trees and a separate layout path for 2–3–4 nodes and children. It computes subtree widths, places descendants, and adjusts the view to fit the resulting bounds. Keeping the multiway representation explicit preserves the algorithm's structure instead of forcing every implementation into an identical binary picture.

Interpret structural work carefully

The operation chart counts logged spins, splits, borrows, and merges. It gives a concrete view of how much restructuring accompanies the same insertion stream. Red-black recoloring appears in the event records but is excluded from this chart. Comparing the chart with the actual node arrangement makes that accounting choice visible.

A useful sequence is to compare a sorted batch with a random batch, then repeat an earlier range. Watch the unbalanced tree's shape, the balancing changes in the other structures, and the splay tree's movement toward the inserted or revisited value. This is a small instrumented study of implementation behavior: the diagrams and counters help explain what a balancing policy does on a particular input.

These are structural measurements, not frame-rate benchmarks. Treap guarantees are expected, splay guarantees are amortized, and AVL/red-black invariants differ; one generic “balance score” would hide those distinctions.

Current scope

  • The structural-event chart excludes recoloring and traversal work. It is not a timing benchmark or a complete accounting of implementation cost.
  • The public interface currently hides its Delete control, so the exposed comparison workflow emphasizes insertion sequences rather than mixed insertion/deletion workloads.
Explore this fieldFortune’s Loom Symbolic Unfolded Graph algorithms
Page reviewed September 12, 2026. Demonstrations and technical notes reflect the showcased version.
Project overview