Skip to content

ninjudd/priority_queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PriorityQueue

A very simple priority queue.

Usage:

pq = PriorityQueue.new
pq[5]  << 'foo'
pq[10] << 'unimportant foo'
pq[1]  << 'important foo'

pq.shift # => 'important foo'
pq.shift # => 'foo'
pq.shift # => 'unimportant foo'
pq.shift # => nil

PriorityQueue is also enumerable.

Install:

sudo gem install priority-queue -s http://gemcutter.org

License:

Copyright © 2009 Justin Balthrop, Geni.com; Published under The MIT License, see License.txt

About

A simple priority queue for Ruby

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages