cppAcademy
THE TREE LABORATORY

One root.
A world of connections.

Build the structure. Explore the relationships. Follow every step.

08 ALGORITHMS · 150 VERTICESBranch out.
Think deeper.
Unweighted · Undirected · 1-based
Click empty space to add a vertex.
100%

Keyboard: Tab to a vertex or edge. Enter/Space selects or applies the current tool; choose Connect and activate both vertices to connect. Arrows move a vertex; Delete removes the selection in Build mode; Escape cancels. In Build → Add, N adds a vertex. Ctrl/Cmd+Z undoes. Use F to fit and +/− to zoom.

Drag vertices · Wheel to zoom · Pan tool or Shift-drag to pan
VertexSelected / pathVisitedActiveCompletedLCA / result

Ready to grow an idea.

Conventions, controls, and correctness

These are unweighted, undirected trees. Labels start at 1; new vertices take the next available label above the current maximum. One vertex is a valid tree; an empty canvas is not. Forest editing is allowed, but tree algorithms require connectivity. A rooted leaf has no children; the center algorithm instead starts from vertices of undirected degree at most one.

Binary shape properties require explicit left/right slots. Generating a binary tree defines these slots. Structural edits clear them; changing to a different root hides them because left/right orientation no longer applies. Re-select the original root to recover unchanged relationships. Balanced Binary Tree divides remaining vertices evenly; Complete Binary Tree fills each level from left to right.

Keyboard: Delete/Backspace removes the Build selection; arrows move a selected vertex; Ctrl/Cmd+Z undoes; Shift+Ctrl/Cmd+Z redoes; F fits; +/− zooms. The canvas must have focus. On touch screens choose Pan, or drag a vertex directly. All algorithm frames are generated by real traversals and restored exactly when stepping backward.

References: Binary lifting and LCA ↗ · Rooted tree terminology ↗