binaryheap-resizable
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -10,3 +10,3 @@ /** | ||
if (!(this instanceof BinaryHeapR)) { | ||
return new BinaryHeapR(capacity); | ||
return new BinaryHeapR(capacity, predicate); | ||
} | ||
@@ -13,0 +13,0 @@ |
{ | ||
"author" : "Roberto Sales <robertosalesc@dcc.ufba.br>", | ||
"name": "binaryheap-resizable", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "binary heap implemented over a resizable circular buffer", | ||
@@ -6,0 +6,0 @@ "keywords": ["binary", "heap", "circular buffer", "tree"], |
15
test.js
@@ -7,10 +7,13 @@ /** | ||
var heap = heapProvider(20); | ||
var heap = heapProvider(6, function(a,b){ | ||
console.log("A: " + a.priority); | ||
console.log("B: " + b.priority); | ||
return a.priority > b.priority}); | ||
heap.push(8); | ||
heap.push(3); | ||
heap.push(11); | ||
heap.push({priority: 8}); | ||
heap.push({priority: 3}); | ||
heap.push({priority: 11}); | ||
console.log(heap.toArray()); | ||
heap.push(5); | ||
heap.push(4); | ||
heap.push({priority: 5}); | ||
heap.push({priority: 4}); | ||
@@ -17,0 +20,0 @@ console.log(heap); |
Sorry, the diff of this file is not supported yet
22023
113