예제 #1
0
 public PersistentMap <K, T> Remove(K key)
 {
     if (!Contains(key))
     {
         return(new PersistentTreapMap <K, T>(root));
     }
     return(new PersistentTreapMap <K, T>(root.Remove(key)));
 }
예제 #2
0
            public TreapNode Remove(K key)
            {
                int b = key.CompareTo(this.key);

                if (b == 0)
                {
                    return((left == null) ? (right != null ? new TreapNode(right) : null) : left.Merge(right));
                }
                if (b < 0)
                {
                    return(new TreapNode(this, left != null ? left.Remove(key) : null, right));
                }
                else
                {
                    return(new TreapNode(this, left, right != null ? right.Remove(key) : null));
                }
            }