hangyas / PriorityQueue

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PriorityQueue

A Heap implementation in crystal.

Installation

Add it to Projectfile

deps do
  github "hangyas/PriorityQueue"
end

Usage

require "PriorityQueue"

q = PriorityQueue{5, 2, 9}

q.pop #9
q.pop #5
q.pop #2

#custom order
q = PriorityQueue(Int32).new {|a, b| a < b}
q << 5 << 2 << 9

q.pop #2
q.pop #5
q.pop #9

About

License:MIT License


Languages

Language:Crystal 100.0%