The Balanced binary tree (balanced Binary) is an evolutionary body of two-fork lookup trees and the first two-fork tree to introduce the concept of equilibrium. In the 1962, G.M Adelson-velsky and E.M Landis invented the tree, so it was called an AVL tree. Balanced binary tree requirements for each node, its left and right subtree of the height of the difference can not exceed 1, if the insertion or deletion of a node so that the height difference is greater than 1, it is necessary to rotate between the nodes, the two-fork tree back in a balanced state. This scheme is a good solution to the problem of two-fork lookup tree degradation into a linked list, to insert, find, delete the time complexity of the best and worst-case conditions are maintained in O (Logn). However, frequent rotation causes insertions and deletions to sacrifice O (Logn) time, but the time is much more stable relative to the binary lookup tree.
The balance of binary tree implementation of most of the process and two fork lookup tree is the same (learn to balance the binary tree must be binary lookup tree), the difference is that after inserting and deleting to write a rotation algorithm to maintain balance, maintaining balance requires the use of a node height of the attribute.
Reprint Link Reference link