Priority::MaxHeap(K, V)
Inherits Priority::Heap < Reference < Object
A MaxHeap is a heap where the items are returned in descending order of key value.
Constructors
new
call-seq: MaxHeap.new(ary) -> new_heap
Creates a new MaxHeap with an optional array parameter of items to insert into the heap. A MaxHeap is created by calling Heap.new { |x, y| (x <=> y) == 1 }, so this is a convenience class.
maxheap = MaxHeap.new([1, 2, 3, 4])
maxheap.pop #=> 4
maxheap.pop #=> 3