Skip to content

Glossary: Data Structures and Algorithms in Java

PriorityQueue

Java's priority queue, a min-heap in an array. `offer` and `poll` are O(log n), `peek` is O(1), and a `Comparator` chooses what counts as smaller.

Where the book teaches it

Related terms

heapcomparatormax-heapoffer, poll, peek