priority_queue
Advanced tools
Comparing version
{ "name": "priority_queue" | ||
, "version": "0.1.2" | ||
, "version": "0.1.3" | ||
, "description": "simple priority queue using a binary heap" | ||
@@ -4,0 +4,0 @@ , "main": "./priority_queue.js" |
@@ -1,4 +0,5 @@ | ||
var agnat_priority_queue = (function() { // namespace | ||
(function() { // namespace | ||
var exports = (typeof module !== 'undefined' && module.exports) ? module.exports : {}; | ||
var exports = (typeof module !== 'undefined' && module.exports) ? | ||
module.exports : window.priority_queue = {}; | ||
@@ -39,3 +40,3 @@ exports.PriorityQueue = function PriorityQueue(compare, queue) { | ||
j = i; p = parent(i); | ||
for(; j >= 0 && compare(queue[j], queue[p]) < 0; j = p, p = parent(j)) { | ||
for (; j > 0 && compare(queue[j], queue[p]) < 0; j = p, p = parent(j)) { | ||
swap(j, p); | ||
@@ -61,2 +62,2 @@ } | ||
return exports; })(); // end of namespace | ||
})(); // end of namespace |
192
0.52%9815
-0.15%