Example #1
0
        public static bool Contains(T value, RedBlackTree <T> tree)
        {
            if (tree.IsEmpty)
            {
                return(false);
            }
            else
            {
                int compareResult = Comparer <T> .Default.Compare(value, tree.Value);

                if (compareResult < 0)
                {
                    return(Contains(value, tree.Left));
                }
                else if (compareResult > 0)
                {
                    return(Contains(value, tree.Right));
                }
                else
                {
                    return(true);
                }
            }
        }
Example #2
0
 public RedBlackTree <T> Insert(T value)
 {
     return(RedBlackTree <T> .Insert(value, this));
 }
Example #3
0
 public bool Contains(T value)
 {
     return(RedBlackTree <T> .Contains(value, this));
 }