class PriorityQueue::MaxHeap(T)

Overview

Implements a maximum-first PriorityQueue using an array-based heap. This implementation subclasses MinHeap but reverses element comparisons.

Defined in:

priorityqueue.cr

Constructors

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.


[View source]
def self.new #

Constructs an empty PriorityQueue.


[View source]