All tree types

AVL tree

Height-balanced. Each node shows its balance factor, height(right) − height(left); when one reaches ±2, a rotation fixes it.

Build the tree
Course examples

Each one clears the tree first and inserts from scratch.

Nine values in a helpful order — the tree stays short.

The same nine values in order. The tree becomes a stick, and searching it is no better than scanning a list — this is why the balanced trees exist.

The AVL page's worked example. The first five values build the page's starting tree; then inserting 30 forces a single rotation and inserting 27 forces a double rotation.

Nodes: 0 of 24

Height:

Insert a value, or load one of the course examples.

step 0 / 0