{"_id":"heap","_rev":"30-ec1b2675bcb89e437c7d00c6992877cd","name":"heap","description":"binary heap (priority queue) algorithms (ported from Python's heapq module)","dist-tags":{"latest":"0.2.7"},"versions":{"0.1.0":{"name":"heap","version":"0.1.0","description":"binary heap (priority queue) algorithms (ported from Python's heapq module)","homepage":"https://github.com/qiao/heap.js","keywords":["algorithm","data structure","heap"],"author":{"name":"Xueqiao Xu","email":"xueqiaoxu@gmail.com"},"main":"./index.js","dependencies":{},"devDependencies":{"coffee-script":">= 1.2.0","mocha":">= 0.14.0","should":">= 0.6.0"},"repository":{"type":"git","url":"git://github.com/qiao/heap.js.git"},"licenses":[{"type":"MIT","url":"http://opensource.org/licenses/mit-license.php"}],"_npmUser":{"name":"qiao","email":"xueqiaoxu@gmail.com"},"_id":"heap@0.1.0","optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.9","_nodeVersion":"v0.6.13","_defaultsLoaded":true,"dist":{"shasum":"d601715c7717fd9915fbbc35c8805f4a49f6f229","tarball":"https://registry.npmjs.org/heap/-/heap-0.1.0.tgz","integrity":"sha512-591neDntmNpgxw2lOvZaPrXAW/dknydmJJJRUaMm0YLRULcEpT35+i5+VdeS1zin5klCtR65j4egkw/M4L7j9w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFJdq0OFfGN9JllN+3EetEYVF4UffdmTWGimnDRi1gL0AiAgu1DFDrbfhFG16y6xEOUdOS5oUEChN5BqQdY1mbdAdg=="}]},"maintainers":[{"name":"qiao","email":"xueqiaoxu@gmail.com"}],"directories":{}},"0.1.2":{"name":"heap","version":"0.1.2","description":"binary heap (priority queue) algorithms (ported from Python's heapq module)","homepage":"https://github.com/qiao/heap.js","keywords":["algorithm","data structure","heap"],"author":{"name":"Xueqiao Xu","email":"xueqiaoxu@gmail.com"},"main":"./index.js","dependencies":{},"devDependencies":{"coffee-script":">= 1.2.0","mocha":">= 0.14.0","should":">= 0.6.0"},"repository":{"type":"git","url":"git://github.com/qiao/heap.js.git"},"licenses":[{"type":"PSF","url":"http://docs.python.org/license.html"}],"_npmUser":{"name":"qiao","email":"xueqiaoxu@gmail.com"},"_id":"heap@0.1.2","optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.9","_nodeVersion":"v0.6.13","_defaultsLoaded":true,"dist":{"shasum":"fb43eb55ad974c7b17b8942d05740dc44cc27ac8","tarball":"https://registry.npmjs.org/heap/-/heap-0.1.2.tgz","integrity":"sha512-9gG1yS9IomyOb/d4w+RK2OKm3yyIlslo+x8xJATdUb9DAIoPKfsO3L1ZxrP4RIzg34TI/WTvRuCw5b9M1koAbA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRaGm1ztRVzRATCQmEgBg6M/URBg6w9psgyeB/iYFF2wIgL33TG4ede21XRVzu83u+4HKfDrENI5AC8SKuSXycbXo="}]},"maintainers":[{"name":"qiao","email":"xueqiaoxu@gmail.com"}],"directories":{}},"0.2.0":{"name":"heap","version":"0.2.0","description":"binary heap (priority queue) algorithms (ported from Python's heapq module)","homepage":"https://github.com/qiao/heap.js","keywords":["algorithm","data structure","heap"],"author":{"name":"Xueqiao Xu","email":"xueqiaoxu@gmail.com"},"main":"./index.js","dependencies":{},"devDependencies":{"coffee-script":">= 1.3.0","mocha":">= 0.14.0","should":">= 0.6.0"},"repository":{"type":"git","url":"git://github.com/qiao/heap.js.git"},"licenses":[{"type":"PSF","url":"http://docs.python.org/license.html"}],"_npmUser":{"name":"qiao","email":"xueqiaoxu@gmail.com"},"_id":"heap@0.2.0","optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.18","_nodeVersion":"v0.6.15","_defaultsLoaded":true,"dist":{"shasum":"8ea3bbd03f9cc17509dc0aed4502523eb4963486","tarball":"https://registry.npmjs.org/heap/-/heap-0.2.0.tgz","integrity":"sha512-YscTQk3H1aAk2g/qGK/o+UylzP+IgkW7GxT/7cDHkdkz4/DJdAvXJnbnRs/9yJ5n/kT+AQ3SbL57apBY3D/Ecg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHAci6B57RTTnhKe09Ee9R5QUKqn97qaLoS5Vrlu9NFzAiBkBYobaXq3Kv5pYbmVC4U2VJT4OiruCJKxGXaCHZn7BA=="}]},"maintainers":[{"name":"qiao","email":"xueqiaoxu@gmail.com"}],"directories":{}},"0.2.1":{"name":"heap","version":"0.2.1","description":"binary heap (priority queue) algorithms (ported from Python's heapq module)","homepage":"https://github.com/qiao/heap.js","keywords":["algorithm","data structure","heap"],"author":{"name":"Xueqiao Xu","email":"xueqiaoxu@gmail.com"},"main":"./index.js","dependencies":{},"devDependencies":{"coffee-script":"1.3.x","mocha":"1.0.x","should":"0.6.x"},"repository":{"type":"git","url":"git://github.com/qiao/heap.js.git"},"licenses":[{"type":"PSF","url":"http://docs.python.org/license.html"}],"_npmUser":{"name":"qiao","email":"xueqiaoxu@gmail.com"},"_id":"heap@0.2.1","optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.18","_nodeVersion":"v0.6.15","_defaultsLoaded":true,"dist":{"shasum":"85829b1ea798ce41a548fa908c069baa075152ad","tarball":"https://registry.npmjs.org/heap/-/heap-0.2.1.tgz","integrity":"sha512-F/aGWnbu5zYZta4cxfZQHwFtRDEbX6tUswXgdmZw5hGgmDCH7LkYsoDWgpzPCJru+iH4RqGuam698ggLjL6wRw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD6NpTYNJ9u8vNqYMJ0GbWVbN6/KQb9LiS/gpWoF/UIwAIgTWkTqe36RyJeWzKPaTGoGsSJir+2x/FyVj0BBHfFgBo="}]},"maintainers":[{"name":"qiao","email":"xueqiaoxu@gmail.com"}],"directories":{}},"0.2.2":{"name":"heap","version":"0.2.2","description":"binary heap (priority queue) algorithms (ported from Python's heapq module)","homepage":"https://github.com/qiao/heap.js","keywords":["algorithm","data structure","heap"],"author":{"name":"Xueqiao Xu","email":"xueqiaoxu@gmail.com"},"main":"./index.js","dependencies":{},"devDependencies":{"coffee-script":"1.3.x","mocha":"1.0.x","should":"0.6.x"},"repository":{"type":"git","url":"git://github.com/qiao/heap.js.git"},"licenses":[{"type":"PSF","url":"http://docs.python.org/license.html"}],"bugs":{"url":"https://github.com/qiao/heap.js/issues"},"_id":"heap@0.2.2","dist":{"shasum":"fc204a17e6bc58a4ef75a98bc1ac795f147c8a1f","tarball":"https://registry.npmjs.org/heap/-/heap-0.2.2.tgz","integrity":"sha512-xuIF+2SUVhAnl4bBrNUkRBFhIyNXgkUP4KgN0Di5KdU+tVlGEVQbfLl/SmxfVHjlhxk5gpvSon6POepIL932HQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCrF0A65jvC91ZZWVLvWg5gl9lWe4lfMgh0YXxz69BfsgIhAP0MooJ5r5msgIgpN/djlXXFB58iha3oR1xAul2Frv/j"}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"qiao","email":"xueqiaoxu@gmail.com"},"maintainers":[{"name":"qiao","email":"xueqiaoxu@gmail.com"}],"directories":{}},"0.2.3":{"name":"heap","version":"0.2.3","description":"binary heap (priority queue) algorithms (ported from Python's heapq module)","homepage":"https://github.com/qiao/heap.js","keywords":["algorithm","data structure","heap"],"author":{"name":"Xueqiao Xu","email":"xueqiaoxu@gmail.com"},"main":"./index.js","dependencies":{},"devDependencies":{"coffee-script":"1.3.x","mocha":"1.0.x","should":"0.6.x"},"repository":{"type":"git","url":"git://github.com/qiao/heap.js.git"},"licenses":[{"type":"PSF","url":"http://docs.python.org/license.html"}],"bugs":{"url":"https://github.com/qiao/heap.js/issues"},"_id":"heap@0.2.3","dist":{"shasum":"59f1466e0f40e9fec41866e5261d01780f90577b","tarball":"https://registry.npmjs.org/heap/-/heap-0.2.3.tgz","integrity":"sha512-TwDNqfqsfgb3L2oeqsMtJBospJ+G1j1nkMqJ6u7B7djmTbpzpGr3jKhCLlqp3fIHtWkKmIMH60Yxvm9J6wAKXA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDlCbWSH1GG4lIh700pdlEHDWlG6OeNfdc2/gu1fV8mqgIgLq0sTXadoRSvxWB1eHxpngh2h4MP62loI2gW4hOd+sI="}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"qiao","email":"xueqiaoxu@gmail.com"},"maintainers":[{"name":"qiao","email":"xueqiaoxu@gmail.com"}],"directories":{}},"0.2.4":{"name":"heap","version":"0.2.4","description":"binary heap (priority queue) algorithms (ported from Python's heapq module)","homepage":"https://github.com/qiao/heap.js","keywords":["algorithm","data structure","heap"],"author":{"name":"Xueqiao Xu","email":"xueqiaoxu@gmail.com"},"main":"./index.js","dependencies":{},"devDependencies":{"coffee-script":"1.3.x","mocha":"1.0.x","should":"0.6.x"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/qiao/heap.js.git"},"licenses":[{"type":"PSF","url":"http://docs.python.org/license.html"}],"gitHead":"c782fab6f0bb8bfc16c72387d2916034c84debbe","bugs":{"url":"https://github.com/qiao/heap.js/issues"},"_id":"heap@0.2.4","_shasum":"e96b141eb7956882de41945a6c5bbb985fd3cfae","_from":".","_npmVersion":"1.4.16","_npmUser":{"name":"qiao","email":"xueqiaoxu@gmail.com"},"maintainers":[{"name":"qiao","email":"xueqiaoxu@gmail.com"}],"dist":{"shasum":"e96b141eb7956882de41945a6c5bbb985fd3cfae","tarball":"https://registry.npmjs.org/heap/-/heap-0.2.4.tgz","integrity":"sha512-3QsNg6vbyzyU9yeehHeh8U1VnKr6lDT0PnAGbanXvTbZ/HAQEctqeOnY1Vl9WqILrrd/cZh7DwmRNLYPTneVDg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCrb4U9oJobKcPy4J7unOHsIZBzpoQvz7lGQDpfKfKDgQIgHwfYDEh4vtSS3GC9uxvRhbppFJyh9ukEKuzVU7KvkiQ="}]},"directories":{}},"0.2.5":{"name":"heap","version":"0.2.5","description":"binary heap (priority queue) algorithms (ported from Python's heapq module)","homepage":"https://github.com/qiao/heap.js","keywords":["algorithm","data structure","heap"],"author":{"name":"Xueqiao Xu","email":"xueqiaoxu@gmail.com"},"main":"./index.js","dependencies":{},"devDependencies":{"coffee-script":"1.3.x","mocha":"1.0.x","should":"0.6.x"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/qiao/heap.js.git"},"licenses":[{"type":"PSF","url":"http://docs.python.org/license.html"}],"gitHead":"0eda661c983504ee239aeae6191401fad3ef4c55","bugs":{"url":"https://github.com/qiao/heap.js/issues"},"_id":"heap@0.2.5","_shasum":"713b65590ebcc40fcbeeaf55e851694092b39af1","_from":".","_npmVersion":"1.4.16","_npmUser":{"name":"qiao","email":"xueqiaoxu@gmail.com"},"maintainers":[{"name":"qiao","email":"xueqiaoxu@gmail.com"}],"dist":{"shasum":"713b65590ebcc40fcbeeaf55e851694092b39af1","tarball":"https://registry.npmjs.org/heap/-/heap-0.2.5.tgz","integrity":"sha512-G7HLD+WKcrOyJP5VQwYZNC3Z6FcQ7YYjEFiFoIj8PfEr73mu421o8B1N5DKUcc8K37EsJ2XXWA8DtrDz/2dReg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDmykn0UD0Og7U0io5sS8HIuF/2DTZVX7rG+FZHJb7eaAIhAPcQCgTeDnXdASfjKZBzWKCvKEW+ycqZBATx97gzJIUd"}]},"directories":{}},"0.2.6":{"name":"heap","version":"0.2.6","description":"binary heap (priority queue) algorithms (ported from Python's heapq module)","homepage":"https://github.com/qiao/heap.js","keywords":["algorithm","data structure","heap"],"author":{"name":"Xueqiao Xu","email":"xueqiaoxu@gmail.com"},"main":"./index.js","dependencies":{},"devDependencies":{"coffee-script":"1.3.x","mocha":"2.1.x","should":"0.6.x"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/qiao/heap.js.git"},"licenses":[{"type":"PSF","url":"http://docs.python.org/license.html"}],"gitHead":"6244ef82933f42ae0e8e0e60aff7196f3f2feb61","bugs":{"url":"https://github.com/qiao/heap.js/issues"},"_id":"heap@0.2.6","_shasum":"087e1f10b046932fc8594dd9e6d378afc9d1e5ac","_from":".","_npmVersion":"2.1.6","_nodeVersion":"0.10.33","_npmUser":{"name":"qiao","email":"xueqiaoxu@gmail.com"},"maintainers":[{"name":"qiao","email":"xueqiaoxu@gmail.com"}],"dist":{"shasum":"087e1f10b046932fc8594dd9e6d378afc9d1e5ac","tarball":"https://registry.npmjs.org/heap/-/heap-0.2.6.tgz","integrity":"sha512-MzzWcnfB1e4EG2vHi3dXHoBupmuXNZzx6pY6HldVS55JKKBoq3xOyzfSaZRkJp37HIhEYC78knabHff3zc4dQQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICkeQzdugGDmDfohHD4gBVXyBLYxIOfXrFjncwqMXIOFAiALRd4AtC/IsFRRL785CuTF772jZdT7Z6WwWzYb1IrXLw=="}]},"directories":{}},"0.2.7":{"name":"heap","version":"0.2.7","description":"binary heap (priority queue) algorithms (ported from Python's heapq module)","homepage":"https://github.com/qiao/heap.js","keywords":["algorithm","data structure","heap"],"author":{"name":"Xueqiao Xu","email":"xueqiaoxu@gmail.com"},"main":"./index.js","devDependencies":{"coffee-script":"1.3.x","mocha":"2.1.x","should":"0.6.x"},"scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/qiao/heap.js.git"},"license":"MIT","gitHead":"21701c0b9c22039de6f948ed5f6d44e53ae79231","bugs":{"url":"https://github.com/qiao/heap.js/issues"},"_id":"heap@0.2.7","_nodeVersion":"17.0.1","_npmVersion":"8.1.0","dist":{"integrity":"sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==","shasum":"1e6adf711d3f27ce35a81fe3b7bd576c2260a8fc","tarball":"https://registry.npmjs.org/heap/-/heap-0.2.7.tgz","fileCount":10,"unpackedSize":23093,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhqICJCRA9TVsSAnZWagAAZHgP+wWdPeqMxVG3Kl0STO4n\ni4fu0mjzget+KR79uwqozeCHjc/M08zLDG+fsqyEENfQuT99Uxg94tyDejtR\nZTn4IH2GMYh+uO7Cu3pTNULs8eMCxym/sx21xwDdm7vUJRp4XJWdNg8StsKs\ncY46tr5ESThqMPfBHnu+z57ubndbPD6prkNyjZ5luc7RjwtLb2wcCsjXjMnV\nExWcIiThjWMM/l2TNQVB4J3DL15s8FPAdV5MGYPsQ7aJkf4HNMDX6CLtLJq3\ndS1vEMNVbnrezzV4/U1I9xawbj4b2GbZ2N6Qq+nRId/fmNsa//wj6QlidClF\n+OJd5bwuj1biY5RSXy/BwqgMedhmkED9nyN9f8EpQ0fUx0oFmhQ0UWkYafaU\n7tsIG6ksZoSqH9uSB5iQEYO4tFSuPDLJNMJe72iTZa1mvUqyFR4XPSxl9DvC\nWuUHKyL7fz1A/wkRxq1ONO99AnCHGcmEophZK6HoL1yEYb+xooQqtHfTMUx7\nQweYIsyGTyuRQm6AeryiZH79iB6oJMVwKrETBOnXP5BbHcPX0DoN8DvFliHf\nSHRndolJ30+Zc0RX1wbHO4BbPQWPhaYcMM6V2dCpzcnxUoYkeRieEPC0SPDv\n0hTSMKRx5tRitgSkzo6Vu29XO2NJVjvu6BowfPG6mxlyCHxZVo6dCH6IaQ42\nrLs1\r\n=P+NH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCel0A68eJLQHZQt3pRKL0SWv6jIDi4WBlKXFf5LhmhfAIhAMxcnoZ2uscoYuDi09lYqXvDJDGHae+gf6UpajY0x44v"}]},"_npmUser":{"name":"qiao","email":"xueqiaoxu@gmail.com"},"directories":{},"maintainers":[{"name":"qiao","email":"xueqiaoxu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/heap_0.2.7_1638432905165_0.29257309632662976"},"_hasShrinkwrap":false}},"readme":"Heap.js\n=======\n\n[![Build Status](https://travis-ci.org/qiao/heap.js.svg?branch=master)](https://travis-ci.org/qiao/heap.js)\n\nA binary heap implementation in CoffeeScript/JavaScript. Ported from Python's [heapq](http://docs.python.org/library/heapq.html) module.\n\n\nDownload\n--------\n\nThis module can be used in either the browser or node.js.\n\nfor browser use, you may [download the script](https://raw.github.com/qiao/heap.js/master/lib/heap.js) and include it in you web page.\n\n```html\n<script type=\"text/javascript\" src=\"./heap.js\"></script>\n```\n\nfor node.js, you may install it via npm:\n\n```bash\nnpm install heap\n```\n\nthen require it:\n\n```\nvar Heap = require('heap');\n```\n\nExamples\n-------\n\n\npush and pop\n\n```js\nvar heap = new Heap();\nheap.push(3);\nheap.push(1);\nheap.push(2);\nheap.pop(); // 1\n```\n\ncustom comparison function\n\n```js\nvar heap = new Heap(function(a, b) {\n    return a.foo - b.foo;\n});\nheap.push({foo: 3});\nheap.push({foo: 1});\nheap.push({foo: 2});\nheap.pop(); // {foo: 1}\n```\n\nfind 3 largest/smallest items in an array\n\n```js\nvar array = [1, 3, 4, 2, 5];\nHeap.nlargest(array, 3);  // [5, 4, 3]\nHeap.nsmallest(array, 3); // [1, 2, 3]\n```\n\nDocument\n--------\n\nThis module exposes only one object, namely the Heap class.\n\n### Constructor: Heap([cmp]) ###\n\nThe constructor receives a comparison function as an optional parameter. If omitted, the heap is built as a min-heap, which means that the smallest element will be popped out first.\n\nIf the comparison function is supplied, the heap will be built according to the \nreturn value of the comparison function.\n\n* if cmp(a, b) < 0, then item a will come prior to b\n* if cmp(a, b) > 0, then item b will come prior to a\n\nSo, the comparison function has the following form:\n\n```js\nfunction cmp(a, b) {\n  if (a is prior to b) {\n    return -1;\n  } \n  if (b is prior to a) {\n    return 1;\n  }\n  return 0;\n}\n```\n\nTo compare numbers, simply: \n\n```js\nfunction cmp(a, b) {\n  return a - b;\n}\n```\n\n### Instance Methods ###\n\n**push(item)** (alias: **insert**) \n\nPush item onto heap.\n\n**pop()**\n\nPop the smallest item off the heap and return it.\n\n**peek()** (alias: **top** / **front**)\n\nReturn the smallest item of the heap.\n\n**replace(item)**\n\nPop and return the current smallest value, and add the new item.\n\nThis is more efficient than pop() followed by push(), and can be \nmore appropriate when using a fixed size heap. Note that the value\nreturned may be larger than item! \n\n**pushpop(item)**\n\nFast version of a push followed by a pop.\n\n**heapify()**\n\nRebuild the heap. This method may come handy when the priority of the \ninternal data is being modified.\n\n**updateItem(item)**\n\nUpdate the position of the given item in the heap.\nThis function should be called every time the item is being modified.\n\n**empty()**\n\nDetermine whether the heap is empty.\n\n**size()**\n\nGet the number of elements stored in the heap.\n\n**toArray()**\n\nReturn the array representation of the heap. (note: the array is a shallow copy of the heap's internal nodes)\n\n**clone()** (alias: **copy**)\n\nReturn a clone of the heap. (note: the internal data is a shallow copy of the original one)\n\n### Static Methods ###\n\nNOTE: All the static methods are designed to be applied on arrays.\n\n**push(array, item, [cmp])** \n\nPush item onto array, maintaining the heap invariant.\n\n**pop(array, [cmp])**\n\nPop the smallest item off the array, maintaining the heap invariant.\n\n**replace(array, item, [cmp])**\n\nPop and return the current smallest value, and add the new item.\n\nThis is more efficient than heappop() followed by heappush(), and can be \nmore appropriate when using a fixed size heap. Note that the value\nreturned may be larger than item! \n\n**pushpop(array, item, [cmp])**\n\nFast version of a heappush followed by a heappop.\n\n**heapify(array, [cmp])**\n\nBuild the heap.\n\n**updateItem(array, item, [cmp])**\n\nUpdate the position of the given item in the heap.\nThis function should be called every time the item is being modified.\n\n**nlargest(array, n, [cmp])**\n\nFind the n largest elements in a dataset.\n\n**nsmallest(array, n, [cmp])**\n\nFind the n smallest elements in a dataset.\n","maintainers":[{"name":"qiao","email":"xueqiaoxu@gmail.com"}],"time":{"modified":"2022-06-18T19:46:02.285Z","created":"2012-03-23T17:42:05.200Z","0.1.0":"2012-03-23T17:42:10.947Z","0.1.2":"2012-03-24T03:21:50.261Z","0.2.0":"2012-04-22T16:50:06.403Z","0.2.1":"2012-04-29T06:21:25.285Z","0.2.2":"2013-10-16T01:45:20.902Z","0.2.3":"2013-10-23T08:49:10.721Z","0.2.4":"2014-08-13T06:06:50.545Z","0.2.5":"2014-09-10T18:30:11.140Z","0.2.6":"2015-02-09T07:09:00.041Z","0.2.7":"2021-12-02T08:15:05.314Z"},"author":{"name":"Xueqiao Xu","email":"xueqiaoxu@gmail.com"},"repository":{"type":"git","url":"git://github.com/qiao/heap.js.git"},"users":{"pvorb":true,"semencov":true,"kisskie":true,"brunocalou":true,"shanemileham":true,"archarious":true,"scott.m.sarsfield":true},"homepage":"https://github.com/qiao/heap.js","keywords":["algorithm","data structure","heap"],"bugs":{"url":"https://github.com/qiao/heap.js/issues"},"readmeFilename":"README.md","license":"MIT"}