Remove() public method

public Remove ( PQHandle handle ) : void
handle PQHandle
return void
Beispiel #1
0
        public void Remove(PQHandle handle)
        {
            int handle2 = handle._handle;

            if (handle2 >= 0)
            {
                _heap.Remove(handle);
            }
            else
            {
                handle2        = -(handle2 + 1);
                _keys[handle2] = null;
                while (_size > 0 && _keys[_order[_size - 1]] == null)
                {
                    _size--;
                }
            }
        }
Beispiel #2
0
        public void Remove(PQHandle handle)
        {
            Debug.Assert(_initialized);

            int curr = handle._handle;

            if (curr >= 0)
            {
                _heap.Remove(handle);
                return;
            }
            curr = -(curr + 1);
            Debug.Assert(curr < _max && _keys[curr] != null);

            _keys[curr] = null;
            while (_size > 0 && _keys[_order[_size - 1]] == null)
            {
                --_size;
            }
        }