Skip to content

lxynox/binary-heap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BinaryHeap

JS simple binary heap implementation


Usage

  • Client(browser) side (access as globals window.BinayHeap)

    inline hot-link using <script> tag:

    <script type='text/javascript' src='./BinaryHeap.js'></script>

  • Server side (import as ES6/CommonJS/AMD module)

    install via npm npm install binary-heap


API

isEmpty

[check if the heap is empty]

Returns Boolean [is empty or not]

size

[count the number of elements in current heap]

Returns [Number] [size of the heap]

peek

[top element of current heap]

Returns [Object] [top element]

push

[push element into heap]

Parameters

pop

[remove top element from heap]

Returns [Object] [removed element]

contains

[check if contains target element]

Parameters

Returns [Boolean] [contains or not]

remove

[remove target element from heap]

Parameters

Returns [Boolean] [removed or not]

About

JS simple binary heap implementation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published