Priority queue implemented using heap.