Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 870 Bytes

README.md

File metadata and controls

43 lines (29 loc) · 870 Bytes

BinaryHeap

npm version npm version

This is a simple BinaryHeap heap Implementation in nodejs, without dependencies

Functions Average Worst case
push O(1) O(log n)
lower O(1) O(1)

🗃️Pre-Requisites

🛠️ Usage

let BinaryHeap = require("mybinaryheap");

let binaryHeap = new BinaryHeap(2); // limit is set to 2 elements
binaryHeap.push(2);
binaryHeap.push(1);
binaryHeap.push(3);
console.log(binaryHeap.lower()); //  "2"

Contributing

⚠️ Tests

npm install
npm run test

🗃️ Docs

npm run doc

=]