Python heapq Functions
EditRocket provides the following information on heapq functions in the Python source code builder.
heapify(x) - Transform list x into a heap, in-place, in linear time.
heappop(heap) - Pop and return the smallest item from the heap, maintaining the heap invariant.
heappush(heap, item) - Push the value item onto the heap, maintaining the heap invariant.
heapreplace(heap, item) - Pop and return the smallest item from the heap, and also push the new item.
nlargest(n, iterable[, key]) - Return a list with the n largest elements from the dataset defined by iterable.
nsmallest(n, iterable[, key]) - Return a list with the n smallest elements from the dataset defined by iterable.