AVL Tree Rotations Screensaver
The AVL Tree Rotations screensaver grows a real self-balancing AVL tree, performing genuine single and double rotations whenever an insert tips it off balance. It is free, runs in your browser, and ESC exits.
How the AVL Tree Rotations screensaver works
The saver inserts real random values into an AVL tree, a binary search tree that tracks the real height balance of every node.
Whenever an insert makes a node's left and right subtree heights differ by more than one, a real rotation — single or double — fires to restore balance.
Each rotation is drawn live as the actual pivot it is, re-parenting a real subtree rather than just relabeling values.
Once the tree reaches a set size, it holds briefly, then clears and a fresh AVL tree begins growing from empty.
A worked example
Three values inserted in increasing order would make a plain BST lean into a straight line, but the real AVL tree instead performs a single rotation, snapping back into a balanced shape.
Settings & tips
- Accent recolours the node currently rotating.
- This is a real, correct self-balancing AVL tree implementation.
- The tree clears and regrows automatically once it reaches full size.
Frequently asked questions
- Is this a real AVL tree?
- Yes — a real, correct self-balancing AVL tree, with genuine single and double rotations.
- How is this different from a plain BST?
- A real AVL tree actively rebalances after every insert, so it never degrades into a long chain the way a plain BST can.
- Is a key needed?
- No — it is a pure local computation.
- Is it free?
- Yes — free, no download, in your browser.