public void Insert(int value)
 {
     root = Insert(root, value);
 }
 private int Height(AVLNode node)
 {
     return(node?.height ?? -1);
 }
 private int BalanceFactor(AVLNode node)
 {
     return(node == null ? 0 : Height(node.leftChild) - Height(node.rightChild));
 }
 private bool IsRightHeavy(AVLNode node)
 {
     return(BalanceFactor(node) < -1);
 }
 private bool IsLeftHeavy(AVLNode node)
 {
     return(BalanceFactor(node) > 1);
 }
 private void SetHeight(AVLNode node)
 {
     node.height = Math.Max(Height(node.leftChild), Height(node.rightChild)) + 1;
 }