\x89PNG\r\n\x1a\n\x00\x00\x00\x0DIHDR\x00\x00\x00\x01\x00 \x00\x00\x01\x08\x06\x00\x00\x00\x1F\x15\xC4\x89\x00\x00\x00 \x0AIDATx\x9Ccb\x00\x00\x00\x06\x00\x03\x1A\x05\x9D\x00\x00 \x00\x00IEND\xAE\x42\x60\x82
| Path : /var/www/html/tool-ob/ToolsPortal/node_modules/binaryheap/ |
|
B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H |
| Current File : /var/www/html/tool-ob/ToolsPortal/node_modules/binaryheap/README.md |
BinaryHeap
==========
Basic binary heap tree using linked lists
Usage
-----
```javascript
var BinaryHeap = require('binaryheap');
var heap = new BinaryHeap();
var a = [6, 5, 3, 1, 8, 7, 2, 4];
a.forEach(function (k) {
heap.insert({ value: k }, k);
});
heap.print();
while (heap.length) {
console.log('popping', heap.pop().value);
}
```
By default it stores as a max-heap, if you pass truthy to the constructor though
it will behave as a min-heap.
Methods
-------
* `insert(obj, key)` -- obj can be any new or existing object, and key is any
value that behaves sanely with `>` or `<`
* `pop()` -- removes and returns the maximum or minimum object from the root
of the heap
* `remove(obj)` -- removes a previously inserted object from the heap
* `print()` -- mostly for debugging purposes prints a graphviz dot style
digraph to confirm ordering
Members
-------
* `length` -- number of objects currently in the heap