A simple priority queue implementation, inspired by the article Implementing a Priority Queue in Ruby by Brian Storti, written mostly as an exercise in Crystal.
Add this to your application's shard.yml
:
dependencies:
priority_queue:
github: amadanmath/priority_queue.cr
require "priority_queue"
queue = PriorityQueue(Int32, String).new
queue[3] = "Three"
queue[100] = "Hundred"
queue[0] = "Zero"
queue.pop # => "Hundred"
queue.pop # => "Three"
queue.size # => 1
- Fork it ( https://github.com/amadanmath/priority_queue.cr/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- amadanmath Goran Topic - creator, maintainer