平衡树——自平衡二叉树(Balanced Tree - AVL Tree)
定义(Definition)
An AVL tree is a self-balancing binary search tree. It was named after its two inventors: Georgy Adelson-Velsky and Evgenii Landis.
Recall that we define the height of the empty tree as -1. For a binary search tree, let the balance factor to be the difference between the height of its left sub-tree and that of its right sub-tree. For each sub-tree in AVL tree, the balance factor of each node is -1, 0 or 1.
Which are AVL trees?
The first one and second one are AVL trees.
The third one is not AVL tree because the height of node 10 is 2.
the fourth one is also not AVL tree because t