Exemplo n.º 1
0
 /// <summary>
 /// Determines the balance of a given node
 /// </summary>
 protected virtual int getBalance(AVLTreeNode <T> root)
 {
     //Balance = right child's height - left child's height
     return(this.GetHeight(root.RightChild) - this.GetHeight(root.LeftChild));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Removes a given value from the tree and rebalances the tree if necessary.
        /// </summary>
        public override bool Remove(T value)
        {
            AVLTreeNode <T> valueNode = this.Find(value);

            return(this.Remove(valueNode));
        }