Example #1
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));
                }
            }