Priority Queues
Last updated
Last updated
Heap-based implementations run at O(N log K). (K stream of N items)
Space: O(K)
Enqueue and dequeue take O(log N) time. Peeking min is O(1). (N = number of items to compare)
Java's PQ contain() and remove(Object) run in O(N) time.