コード例 #1
0
        public static T RemoveInOrderPredecessor(ref AVLTreeNode <T> node)
        {
            if (node.Right != null)
            {
                T ret1 = RemoveInOrderPredecessor(ref node.Right);
                node.UpdateHeight();
                node = node.PerformRotations();
                return(ret1);
            }

            T ret = node.Value;

            node = node.Left;
            return(ret);
        }
コード例 #2
0
        public static T RemoveInOrderSuccessor(ref AVLTreeNode <T> node)
        {
            if (node.Left != null)
            {
                node.LeftChildren--;
                T ret1 = RemoveInOrderSuccessor(ref node.Left);
                node.UpdateHeight();
                node = node.PerformRotations();
                return(ret1);
            }

            T ret = node.Value;

            node = node.Right;
            return(ret);
        }