Example #1
0
 public void insert(int value)
 {
     root = insert_node(root, value);
 }
Example #2
0
 private int height(AVLNode node)
 {
     return((node == null)? -1:node.height);
 }
Example #3
0
 private bool isRightHeavy(AVLNode node)
 {
     return(balanceFactor(node) < -1);
 }
Example #4
0
 private bool isLeftHeavy(AVLNode node)
 {
     return(balanceFactor(node) > 1);
 }
Example #5
0
 private int balanceFactor(AVLNode node)
 {
     return((root == null)? 0: height(node.leftChild) - height(node.rightChild));
 }
Example #6
0
 private bool isLeaf(AVLNode root)
 {
     return(root.leftChild == null && root.rightChild == null);
 }