LET’S TALK
Back to case study
LIVE DEMO / INTERACTIVE ALGORITHMS

AVL Tree Lab.

Insert, delete, and search synthetic patient IDs. Watch self-balancing rotations unfold, one step at a time.

Real TypeScript AVL operations inspired by the original C++ algorithms. Local browser execution; no patient records are used or stored.
CONTROL CENTER01 / OPERATIONS
ROTATION PLAYGROUND01–04

Load a minimal example and watch the exact rotation case, from imbalance to restoration.

QUICK ACTIONS
TREE VISUALIZATION VALID AVL · 07 NODES
LIVE STRUCTURE / VISUAL STATEBF = LEFT HEIGHT − RIGHT HEIGHT
Patient ID 20, balance factor 0, depth 220BF 0Patient ID 30, balance factor 0, depth 130BF 0Patient ID 40, balance factor 0, depth 240BF 0Patient ID 50, balance factor 0, depth 050BF 0Patient ID 60, balance factor 0, depth 260BF 0Patient ID 70, balance factor 0, depth 170BF 0Patient ID 80, balance factor 0, depth 280BF 0
Node / ID Current path ConnectionScroll horizontally for large trees
STEP 01 / 01 COMPLETE

A balanced starting point

Seven sample patient IDs are arranged in a valid AVL tree. Try inserting 10, searching for 60, or loading a rotation preset.

NODES7Unique IDs
HEIGHT3Levels
ROTATIONS—Current operation
COMPLEXITYO(log n)Search / updates

Inspect the structure

AVL invariants hold
IN-ORDER

20 → 30 → 40 → 50 → 60 → 70 → 80

PRE-ORDER

50 → 30 → 20 → 40 → 70 → 60 → 80

POST-ORDER

20 → 40 → 30 → 60 → 80 → 70 → 50

MINIMUM ID

20

MAXIMUM ID

80