Skip to content
jasper-zanjani edited this page Aug 6, 2020 · 1 revision

Support heaps, data objects where each node is either greater than or equal to its parent (max-heap) or less than or equal to its parent (min-heap) Create a heap from {iterable}

heapq.heapify(iterable)

Remove and return the smallest element of {heap}

heapq.heappop(heap)

Replace the smallest element of {heap} with {element}

heapq.heapreplace(heap,element)

Clone this wiki locally