Removes the smallest element from the heap. This will cause
the trees in the heap to be consolidated, if necessary.
Runtime: O(log n) amortized
769775
public V poll() {
        if (oMinEntry == null) return null;

        final Entry minEntry = oMinEntry;

        // move minEntry's children to the root list
        Entry oFirstChild = minEntry.oFirstChild;
        if (oFirstChild != null) {
            for (Entry childOfMin : getCycle(oFirstChild)) {
                childOfMin.oParent = null;
            }
            mergeLists(oMinEntry, oFirstChild);
        }

        // remove minEntry from root list
        if (size == 1) {
            oMinEntry = null;
        }
        else {
            final Entry next = minEntry.next;
            unlinkFromNeighbors(minEntry);
            oMinEntry = consolidate(next);
        }
        size--;

        return minEntry.value;
    }
697737
@SuppressWarnings("unchecked")
    private void delete(SoftHandle<K, V> n) {
        if (n.tree == null) {
            throw new IllegalArgumentException("Invalid handle!");
        }

        /*
         * Delete from belonging list. Care must be taken as the tree reference
         * is valid only if the node is the first in the list.
         */
        TreeNode<K, V> tree = n.tree;

        if (tree.cHead != n) {
            /*
             * Not first in list. Each case, remove and leave as ghost element.
             */
            if (n.next != null) {
                n.next.prev = n.prev;
            }
            n.prev.next = n.next;
        } else {
            /*
             * First in list
             */
            SoftHandle<K, V> nNext = n.next;
            tree.cHead = nNext;
            if (nNext != null) {
                /*
                 * More elements exists, remove and leave as ghost element.
                 * Update new first element to point to correct tree.
                 */
                nNext.prev = null;
                nNext.tree = tree;
            } else {
                /*
                 * No more elements, sift.
                 */
                sift(tree);

                /*
                 * If still no elements, remove tree.
                 */
                if (tree.cHead == null) {
                    if (tree.parent instanceof TreeNode) {
                        TreeNode<K, V> p = (TreeNode<K, V>) tree.parent;
                        if (p.left == tree) {
                            p.left = null;
                        } else {
                            p.right = null;
                        }
                    } else {
                        delete((RootListNode<K, V>) tree.parent);
                    }
                }

            }
        }

        n.tree = null;
        n.prev = null;
        n.next = null;

        size--;
    }
197720
public void clear() {
    for (int i = 0; i < this.heap.size(); i++)
      this.indices.set(this.heap.get(i), -1);
    this.heap.clear();
  }
1206596
public T remove()
    {
        if ( size == 0 ) {
            return null;
        }
        
        //remove the first element
        Entry<T> o = head.next;
        head.next   = o.next;
        o.next.prev = head;
        
        //bakup the data
        T v         = o.data;
        size--;
        index.remove(v.getValue());
        
        o = null;            //Let gc do its work
        
        return v;
    }
1002518
public Object remove(int index) {

        //Check that the index is less than size because the getInternal
        //method is being called with index - 1 and its checks will therefore
        //not be useful in this case.
        if (index >= size()) {
            throw new IndexOutOfBoundsException("Index out of bounds: "
                                                + index + " >= " + size());
        }

        //Get the node that is previous to the node being removed
        Node previousToRemove;

        if (index == 0) {
            previousToRemove = first;
        } else {
            previousToRemove = getInternal(index - 1);
        }

        //previousToRemove.next will never be null because of the check above
        //that index < size.
        Node toRemove = previousToRemove.next;

        previousToRemove.next = toRemove.next;

        elementCount--;

        //If they removed at the last valid index, then a the last element
        //was removed, therfore update the last pointer
        if (last == toRemove) {
            last = previousToRemove;
        }

        return toRemove.data;
    }
1075137
private void removeLast(HeapEntry<E> entry) {
    indexToEntry.remove(entry.index);
    objectToEntry.remove(entry.object);
  }
1246775
protected void heapify(int position)
  {
//    if (tc.isEntryEnabled())
//      SibTr.entry(tc, "heapify", new Integer(position));

    // Heapify the remaining heap
    int i = -1;
    int l;
    int r;
    int smallest = position;

    // Heapify routine from CMR.
    // This was done without recursion.
    while (smallest != i)
    {
      i = smallest;
      l = left(i);
      r = right(i);
      if ((l < size) && (elements[l].priority < elements[i].priority))
        smallest = l;
      else smallest = i;
      if ((r < size) && (elements[r].priority < elements[smallest].priority))
        smallest = r;
      if (smallest != i)
      {
        PriorityQueueNode tmp = elements[smallest];
        setElement(elements[i], smallest);
        setElement(tmp, i);
      }
    }

//    if (tc.isEntryEnabled())
//      SibTr.exit(tc, "heapify");
  }
895069
public void remove( int first , int last ) {
		if( last < first )
			throw new IllegalArgumentException("first <= last");
		if( last >= size )
			throw new IllegalArgumentException("last must be less than the max size");

		int delta = last-first+1;
		for( int i = last+1; i < size; i++ ) {
			data[i-delta] = data[i];
		}
		size -= delta;
	}
875022
private static <T extends Comparable<? super T>> void heapify(T[] arr) {
        int n = arr.length;
        for (int i = n / 2 - 1; i >= 0; i--)
            SortUtils.siftDown(arr, i, n - 1);
    }
911286
def remove(self, node):
        """"""
        if not isinstance(node, Node):
            raise TypeError('expecting Node instance')
        if node._list is None:
            return
        if node._list is not self:
            raise RuntimeError('node is not contained in list')
        if node._next is None:
            self._last = node._prev  # last node
        else:
            node._next._prev = node._prev
        if node._prev is None:
            self._first = node._next  # first node
        else:
            node._prev._next = node._next
        node._list = node._prev = node._next = None
        self._size -= 1
471043
public T remove() {
        lock.lock();

        try {
            if(queue.isEmpty())
                return null;
            El<T> el=queue.poll();
            count-=el.size;
            not_full.signalAll();
            return el.el;
        }
        finally {
            lock.unlock();
        }
    }
1362204
def pop(self):
        """"""
        root = self.heap[1]
        del self.rank[root]
        x = self.heap.pop()    # remove last leaf
        if self:               # if heap is not empty
            self.heap[1] = x   # put last leaf to root
            self.rank[x] = 1
            self.down(1)       # maintain heap order
        return root
1355897
protected void heapifyUp(int pos, E elem) {
    assert (pos < size && pos >= 0);
    while(pos > 0) {
      final int parent = (pos - 1) >>> 1;
      Object par = queue[parent];

      if(comparator.compare(elem, par) >= 0) {
        break;
      }
      queue[pos] = par;
      pos = parent;
    }
    queue[pos] = elem;
  }
1038434
private void decreaseKeyWithComparator(Node<K, V> n, K newKey) {
        int c = comparator.compare(newKey, n.key);
        if (c > 0) {
            throw new IllegalArgumentException("Keys can only be decreased!");
        }
        n.key = newKey;
        if (c == 0) {
            return;
        }

        if (n.next == null) {
            throw new IllegalArgumentException("Invalid handle!");
        }

        // if not root and heap order violation
        Node<K, V> y = n.parent;
        if (y != null && comparator.compare(n.key, y.key) < 0) {
            cut(n, y);
            cascadingCut(y);
        }

        // update minimum root
        if (comparator.compare(n.key, minRoot.key) < 0) {
            minRoot = n;
        }
    }
983055
public void remove(Node<E> node)
    {
        lock.writeLock().lock();
        assert node.value != null;
        node.value = null;
        try
        {
            size--;

            // go up through each level in the skip list, unlinking this node; this entails
            // simply linking each neighbour to each other, and appending the size of the
            // current level owned by this node's index to the preceding neighbour (since
            // ownership is defined as any node that you must visit through the index,
            // removal of ourselves from a level means the preceding index entry is the
            // entry point to all of the removed node's descendants)
            for (int i = 0 ; i < node.height() ; i++)
            {
                Node<E> prev = node.prev(i);
                Node<E> next = node.next(i);
                assert prev != null;
                prev.setNext(i, next);
                if (next != null)
                    next.setPrev(i, prev);
                prev.size[i] += node.size[i] - 1;
            }

            // then go up the levels, removing 1 from the size at each height above ours
            for (int i = node.height() ; i < maxHeight ; i++)
            {
                // if we're at our height limit, we backtrack at our top level until we
                // hit a neighbour with a greater height
                while (i == node.height())
                    node = node.prev(i - 1);
                node.size[i]--;
            }
        }
        finally
        {
            lock.writeLock().unlock();
        }
    }
624091
private final V finish_removal(BinTreeNode<K,V> node, BinTreeNode<K,V> prev,
				   int son, BinTreeNode<K,V> m) {
	if(m != null) { // set up the links for m
	    m.left  = node.left;
	    m.right = node.right;
	}
	if(prev == null)
	    root = m;
	else {
	    if(son == 0)
		prev.left = m;
	    else
		prev.right = m;
	}

	return node.value;
    }
594819
public void removeMax() {
		Node<RedBlackTreeLong<T>> e = ranges.getMax();
		e.getElement().removeMax();
		if (e.getElement().isEmpty())
			ranges.removeInstance(e.getValue(), e.getElement());
		size--;
	}