Example #1
0
        public IBinarySearchTree <TKey, TValue> LocateNearest(TKey key, Predicate <TValue> isMatch)
        {
            if (isMatch(Value))
            {
                return(this);
            }
            int compare = comparer.Compare(key, theKey);

            if (compare == 0)
            {
                return(this);
            }
            if (compare > 0)
            {
                return(Right.LocateNearest(key, isMatch));
            }
            return(Left.LocateNearest(key, isMatch));
        }