AVL tree
Insert numbers and watch the heights of the branches. A rotation shortens an overgrown branch while preserving key order.
At each node the heights of the left and right subtrees differ by at most one level.
An empty branch has height 0 and a leaf has height 1. The h label gives the node’s height. After an insertion, check the heights on the way back to the root.
An AVL tree of n keys has height O(log n). Search and insertion take O(log n) time.