Skip to content

Instantly share code, notes, and snippets.

/**
* A simple Binary Heap implementation for JS
* https://en.wikipedia.org/wiki/Binary_heap
*
* Useful improvements would support a comparsion function
* and allow object removal by reference.
*/
function Heap () {
var _arr = [];