Minimum() публичный Метод

public Minimum ( ) : TValue
Результат TValue
Пример #1
0
        public TValue ExtractMin()
        {
            Debug.Assert(_initialized);

            if (_size == 0)
            {
                return(_heap.ExtractMin());
            }
            TValue sortMin = _keys[_order[_size - 1]];

            if (!_heap.Empty)
            {
                TValue heapMin = _heap.Minimum();
                if (_leq(heapMin, sortMin))
                {
                    return(_heap.ExtractMin());
                }
            }
            do
            {
                --_size;
            } while (_size > 0 && _keys[_order[_size - 1]] == null);

            return(sortMin);
        }
Пример #2
0
        public TValue ExtractMin()
        {
            if (_size == 0)
            {
                return(_heap.ExtractMin());
            }
            TValue val = _keys[_order[_size - 1]];

            if (!_heap.Empty)
            {
                TValue lhs = _heap.Minimum();
                if (_leq(lhs, val))
                {
                    return(_heap.ExtractMin());
                }
            }
            do
            {
                _size--;
            }while (_size > 0 && _keys[_order[_size - 1]] == null);
            return(val);
        }