iyi

Standard library, 0.18.0

std/heap

A binary heap over Comparable.

import std/heap to use it. Source: src/std/heap.iyi at v0.18.0.

push and pop keep the smallest element at the root, so Heap(Int32) is a min-heap. Empty pop and peek panic with pop of an empty heap and peek of an empty heap. The order is the trait's <=>, the same three-way Enumerable#sorted reads.

Heap(T)class

std/heapiyi doc src/std/heap.iyi
pub class Heap(T)
  def empty? : Bool
  def initialize
  def peek : T where T : Comparable
  def pop : T where T : Comparable
  def push(value : T) : Nil where T : Comparable
  def size : Int32
end