Exemple #1
0
        public Tree Balance()
        {
            int cmp = _subsequent.Nodes() - _preceding.Nodes();

            if (cmp < -2)
            {
                return(RotateRight());
            }
            else
            {
                if (cmp > 2)
                {
                    return(RotateLeft());
                }
                else
                {
                    SetSizeOwnPrecedingSubsequent();
                    return(this);
                }
            }
        }