AVL (Balanced BST) Visualizer
Select an action
Logs
No operations yet
Notes
AVL Tree: A self-balancing BST. Balance is maintained by rotations after each insert or remove.
Insert/Remove: Traverses, then animates any required rotation(s).
Find: Traverses from root, highlights path and node found.
Random: Does a random insert or remove.
AVL limit: 15 (simulates overflow)
Overflow and "not found" events are visually shown.
Controls are disabled during animation for safety.
Try inserting, removing, finding, or random to see AVL balancing!
Implementation (TypeScript)
class AVLTree {
root: Node | null = null;
insert(value: number) { /* ...normal BST insert, then rebalance */ }
remove(value: number) { /* ...BST delete, then rebalance */ }
find(value: number) { /* ...BST search... */ }
}About AVL Trees
An AVL tree is a type of self-balancing BST.
Balancing: After each insertion or removal, the tree checks balance factors and performs single or double rotations to maintain O(log n) height.
Rotations: Left, Right, Left-Right, and Right-Left.
Applications:
- Efficient sorted data storage
- Dynamic search tables
AVL trees guarantee fast search, insert, and find-min/max.
Each node is annotated with its height for educational purposes.