Priority Queues
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. https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/util/PriorityQueue.html
Last updated