1.0.6 • Published 5 years ago
@darkblue_azurite/heap v1.0.6
Heap
A binary heap data structure written in Javascript
Installation
For node.js:
npm install --save @darkblue_azurite/heapthen require it:
var Heap = require("@darkblue_azurite/heap");To use the library directly in the browser, copy the heap.js file from the lib
directory into your project and include it in your webpage. heap.min.js provides
you with a minified version. The files in the lib directory are also transpiled to es5.
<script type="text/javascript" src="./heap.js"></script>
<script type="text/javascript">
  var heap = new Heap(); // available as a global
</script>Example usage
var heap = new Heap();
heap.push(5)
  .push(2)
  .push(1)
  .push(3)
  .push(8);
var arr = heap.toArray(); // [1, 3, 2, 5, 8]