Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Min-Max Heap npm version Build Status

Lightweight min-max heap javascript library for node, browser

Install

npm i minmaxheaps

node

const minmaxheaps = require("minmaxheaps")

let mmheap = new minmaxheaps.MinMaxHeap();

mmheap.push(16);
mmheap.push(-5643);
mmheap.popMin();
mmheap.popMax();
mmheap.popMax();
mmheap.push(123);
mmheap.popMin();
console.log(mmheap.heap);
console.log(mmheap.max());
console.log(mmheap.min());

browser

<head>
    <script src="../dist/minmaxheaps.min.js"></script>
    <script>
        const {MinMaxHeap} = minmaxheap;

        let mmheap = new MinMaxHeap();

        mmheap.push(16);
        mmheap.push(-5643);
        mmheap.popMin();
        mmheap.popMax();
        mmheap.popMax();
        mmheap.push(123);
        mmheap.popMin();
        console.log(mmheap.heap);
        console.log(mmheap.max());
        console.log(mmheap.min());
    </script>
</head>

API

  • new MinMaxHeap([duplicate=true, comparator]), where comparator is optional comparison function and duplicate is optional allow duplicate key (default is true)

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages