uheapq – heap queue algorithm

This module implements a subset of the corresponding CPython module, as described below. For more information, refer to the original CPython documentation: heapq.

This module implements the heap queue algorithm.

A heap queue is simply a list that has its elements stored in a certain way.

1. Functions

1.1. heappush

uheapq.heappush(heap, item)

Push the item onto the heap.

1.2. heappop

uheapq.heappop(heap)

Pop the first item from the heap, and return it. Raises IndexError if heap is empty.

1.3. heapify

uheapq.heapify(x)

Convert the list x into a heap. This is an in-place operation.

powered by GitbookFile Modify: 2020-11-26 20:02:14

results matching ""

    No results matching ""