Sha256: c25d6fcb2fdae3150cbacb836434450de7bef4db5ddd76f34c82fc292bb40802

Contents?: true

Size: 1.57 KB

Versions: 3

Compression:

Stored size: 1.57 KB

Contents

= PQueue

{Home}[http://rubyworks.github.com/pqueue] |
{Code}[http://github.com/rubyworks/pqueue] |
{Docs}[http://rubydoc.info/gems/pqueue/frames] |
{Mail}[http://groups.google.com/group/rubyworks] | #rubyworks

{<img src="http://travis-ci.org/rubyworks/pqueue.png" />}[http://travis-ci.org/rubyworks/pqueue]

== DESCRIPTION

Priority queue with array based heap.

A priority queue is like a standard queue, except that each inserted
elements is given a certain priority, based on the result of the
comparison block given at instantiation time. Also, retrieving an element
from the queue will always return the one with the highest priority
(see #pop and #top).

The default is to compare the elements in respect to their #<=> method.
For example, Numeric elements with higher values will have higher
priorities.

This library is  a rewrite of the original PQueue.rb by K. Kodama and
Heap.rb by Ronald Butler. The two libraries were later merged
and generally improved by Olivier Renaud. Then the whole library 
rewritten by Trans using the original as a functional reference.


== SYNOPSIS

  require 'pqueue'

  pq = PQueue.new([2,3,1]){ |a,b| a > b }

  pq.pop  #=> 3


== ACKNOWLEDGMENTS

Although the library has been completely rewritten since, we still would
like to acknowledge the efforts of the original PQueue authors and
contributors.

* Olivier Renaud (2007)
* Rick Bradley (2003)
* Ronald Butler (2002)
* K Kodama (2001, original library)


== COPYRIGHTS

Copyright (c) 2011 Rubyworks

PQueue is distributable in accordance with the *FreeBSD* license.

See the COPYING.rdoc file for details.

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pqueue-2.0.2 README.rdoc
pqueue-2.0.1 README.rdoc
pqueue-2.0.0 README.rdoc