binary-search-trees

← ~/visualizations

binary-search-trees #

Visualizes the BST ordering invariant (left keys < key(node) < right keys), then animates a comparison-guided search for a target key by highlighting the visited path and showing each comparison/decision. Finally, it demonstrates a local update via insertion: a new node slides into the correct null position and a single parent->child link is attached, emphasizing how the invariant is preserved by local pointer changes.

canvasclick to interact

⏮◀◀▶▶STEP0.25x1xZOOM

t=0s

practical uses #

technical notes #

Responsive tree layout computed each frame; blocky grid snapping (6px*scale) for retro look. Animation cycles through SEARCH/INVARIANT/INSERT over ~4.2s using time-based phases and cubic easing. Highlights are drawn with green/green-dim strokes on black and elbow links for a blocky aesthetic.

← minimum-spanning-treeslinear-programming →