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