project2/p2q2.rb
  PriorityQueue by Ray Toal
  http://cs.lmu.edu/~ray/notes/pqueues/

  Priority Queue, binary heap style, implemented using an array.

  Adapted for our purposes:
    - optimised for ruby 1.8.7 performance
    - removed unused methods
    - changed to sort an array of two elements, with the priority in [1]
    - flattened everything remaining out from the PriorityQueue class


Priority Queue, binary heap style, implemented using an array.

Adapted for our purposes:
optimised for ruby 1.8.7 performance
removed unused methods
changed to sort an array of two elements, with the priority in [1]
flattened everything remaining out from the PriorityQueue class
Priority Queue binary heap style implemented using an array . Adapted for our purposes : optimised for ruby 1 . 8 . 7 performance removed unused methods changed to sort an array of two elements with the priority in [ 1 ] flattened everything remaining out from the PriorityQueue class
def push(x)
  @heap << x
  sift_up(@heap.length - 1)
  self
end
def push ( x ) @heap << x sift_up ( @heap . length - 1 ) self end
PriorityQueue by Ray Toal
http://cs.lmu.edu/~ray/notes/pqueues
PriorityQueue by Ray Toal http : // cs . lmu . edu / ~ray / notes / pqueues
x