class PriorityQueue::MaxHeap(T)
- PriorityQueue::MaxHeap(T)
- PriorityQueue::MinHeap(T)
- Reference
- Object
Overview
Implements a maximum-first PriorityQueue
using an array-based heap.
This implementation subclasses MinHeap
but reverses element comparisons.
Defined in:
priorityqueue.crConstructors
-
.new(data : Enumerable(T))
Constructs a
PriorityQueue
from an initial set of data, in linear time. -
.new
Constructs an empty
PriorityQueue
.
Instance methods inherited from class PriorityQueue::MinHeap(T)
clear
clear,
empty?
empty?,
peek
peek,
pop
pop,
push(element : T)
push,
replace_first(element : T)
replace_first,
size
size
Constructor methods inherited from class PriorityQueue::MinHeap(T)
new(data : Enumerable(T))new new
Constructor Detail
def self.new(data : Enumerable(T))
#
Constructs a PriorityQueue
from an initial set of data, in linear time.
The data can be provided as any Enumerable
collection, such as an Array
.