Пример #1
0
 void Insert(RBBranch <T> node)
 {
     root.Insert(node);
     node.InsertRepair();
     root = node;
     while (root.parent != null)
     {
         root = root.parent;
     }
 }
Пример #2
0
        public override void Insert(RBBranch <T> newNode)
        {
            T   t             = newNode.value;
            int compareResult = t.CompareTo(value);

            if (compareResult == 0)
            {
                throw new ArgumentException(string.Format("Duplicate value {0} specified", t));
            }
            else if (compareResult > 0)
            {
                right.Insert(newNode);
            }
            else
            {
                left.Insert(newNode);
            }
        }