Ejemplo n.º 1
0
 void Insert(RBBranch <T> node)
 {
     root.Insert(node);
     node.InsertRepair();
     root = node;
     while (root.parent != null)
     {
         root = root.parent;
     }
 }
Ejemplo n.º 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);
            }
        }