Пример #1
0
        override public void AddNode(int key)
        {
            NodeAVL node = new NodeAVL(key);

            InsertNode(node);
            CheckAVLPropertyAfterInsertNode(node);
        }
Пример #2
0
        /*******************************************************************************************/
        /*******************************************************************************************/

        private void CheckAVLPropertyAfterInsertNode(NodeAVL node)
        {
            if (node.IsParent() is false)
            {
                return;
            }

            NodeAVL child = node;

            node = ( NodeAVL )node.Parent;

            while (node != null)
            {
                node.IncLevelAVL(child);
                RestoreAVLProperty(node);
                child = node;
                node  = ( NodeAVL )node.Parent;
            }
        }