Path: | lib/more/facets/pqueue.rb |
Last Update: | Mon Jun 01 21:54:17 -0400 2009 |
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 repect to their #> method. For example, Numeric elements with higher values will have higher priorities.
Rick Bradley 2003/02/02, patch for Ruby 1.6.5. Thank you!
Copyright (c) 2005 K.Kodama, Ronald Butler, Olivier Renaud