The nodes of the binary search tree are inserted in different orders, and there will be different depths and average search lengths ASL.
Balanced binary tree (AVL tree): The absolute value of the height difference between the left and right subtrees of an empty tree or any node does not exceed 1, that is |BF(T)|<=1
balance factor: BF(T)=hL-hR hL and hR is the height of the left and right subtrees of T.
The maximum height of an AVL tree with n nodes is O(log2n)
storage
typedef struct AVLNode *AVLTree;
typedef int ElementType;
struct AVLNode{
ElementType Data;
AVLTree Left;
AVLTree Right;
int Height;
};