CGL::BinaryHeap(T)
A simple priority queue implemented as a array-based heap.
Each inserted elements is given a certain priority, based on the result of the comparison. This is a min-heap, which means retrieving an element will always return the one with the highest priority.
To avoid O(n) complexity when deleting an arbitrary element, a map is used to cache indices for each element.
Constructors
Instance methods
clear
Sourcedelete(value : T) : T | Nil
Sourceempty?
Sourceheapify!
Sourceinspect(io)
Sourcenext_priority
Sourcenext_priority
Sourcepeek
Sourcepeek
Sourcepeek?
Sourcepop
Sourceto_a
Sourceto_slice
Source