Retroactive/lib/data_structures/priority_queue.js
function PriorityQueue(initialItems) {

  var self = this;
  MinHeap.call(this, function (a, b) {
    return self.priority(a) < self.priority(b) ? -1 : 1;
  });

  this._priority = {};

  initialItems = initialItems || {};
  Object.keys(initialItems).forEach(function (item) {
    self.insert(item, initialItems[item]);
  });
}
function PriorityQueue(initialItems) {

  var self = this;
  MinHeap.call(this, function (a, b) {
    return self.priority(a) < self.priority(b) ? -1 : 1;
  });

  this._priority = {};

  initialItems = initialItems || {};
  Object.keys(initialItems).forEach(function (item) {
    self.insert(item, initialItems[item]);
  });
}
function PriorityQueue ( initialItems ) { var self = this ; MinHeap . call ( this , function ( a , b ) { return self . priority ( a ) < self . priority ( b ) ? - 1 : 1 ; } ) ; this . _priority = { } ; initialItems = initialItems || { } ; Object . keys ( initialItems ) . forEach ( function ( item ) { self . insert ( item , initialItems [ item ] ) ; } ) ; }
Extends the MinHeap with the only difference that
the heap operations are performed based on the priority of the element
and not on the element itself
Extends the MinHeap with the only difference that the heap operations are performed based on the priority of the element and not on the element itself