There are a number of possible choices for the balance condition for a balanced binary search tree:
-
For each node, the number of nodes in its left subtree should be (almost) the same as the number in its right subtree. (Not really used. Probably messy to implement.)
-
(AVL tree) For each node, the heights of its children should differ by at most 1.
-
(Red Black tree) Add a "color" property to each node: either black or red.
Then the balance condition requires that all paths from the root to a null link have the same number of black nodes. Paths can contain extra red nodes, but with a restriction so that the length of every path is no greater than 2 times the number of black nodes in the path.