PQueue

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.

Thanks

  Rick Bradley 2003/02/02, patch for Ruby 1.6.5. Thank you!

Authors

  • Olivier Renaud
  • K.Kodama (Created original PQueue.rb)
  • Ronald Butler (reated original Heap.rb)

Copying

Copyright (c) 2005 K.Kodama, Ronald Butler, Olivier Renaud