heapq

E431929

heapq is a Python standard library module that provides an implementation of the heap queue algorithm, offering efficient priority queue and heap-based operations on lists.

All labels observed (1)

Label Occurrences
heapq canonical 1

How this entity was disambiguated

Statements (47)

Predicate Object
instanceOf Python standard library module
availableIn Python 2 NERFINISHED
Python 3 NERFINISHED
commonUseCase efficient retrieval of smallest items
merging sorted streams
priority queue implementation
top-k selection
dataStructureType binary heap
defaultHeapOrder min-heap
documentationSection Library Reference – heapq — Heap queue algorithm NERFINISHED
heapifySignature heapify(x)
heappopSignature heappop(heap)
heapProperty parent node is less than or equal to children in min-heap
heappushSignature heappush(heap, item)
implements heap queue algorithm
importSyntax import heapq
introducedBefore Python 3.0 NERFINISHED
license Python Software Foundation License NERFINISHED
maintainedBy Python core developers
mergeSignature merge(*iterables, key=None, reverse=False)
moduleCategory Algorithms and Data Structures
mutatesInPlace True
nlargestSignature nlargest(n, iterable, key=None)
nsmallestSignature nsmallest(n, iterable, key=None)
operatesOn Python list
orderingBasis Python object comparison
partOf Python Standard Library NERFINISHED
programmingLanguage Python
providesFunction heapify
heappop
heappush
heappushpop
heapreplace
merge
nlargest
nsmallest
requires elements to be mutually comparable
supportsCustomPriority via tuple keys
supportsIterables any iterable
supportsMaxHeap via negated priorities or custom keys
supportsMergingSortedIterables True
supportsPriorityQueueUsage True
timeComplexityHeapify O(n)
timeComplexityNlargest O(n log k)
timeComplexityNsmallest O(n log k)
timeComplexityPop O(log n)
timeComplexityPush O(log n)

How these facts were elicited

Referenced by (1)

Full triples — surface form annotated when it differs from this entity's canonical label.