{"_id":"stablepriorityqueue","_rev":"5-ed8a72cc07b170d748aa9108536a73ac","name":"stablepriorityqueue","description":"A stable heap-based priority queue in JavaScript","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"stablepriorityqueue","version":"0.1.0","description":"A stable heap-based priority queue in JavaScript","main":"StablePriorityQueue.js","scripts":{"test":"mocha unit/basictests.js"},"repository":{"type":"git","url":"git+https://github.com/lemire/StablePriorityQueue.js.git"},"keywords":["heap","binary heap","data structure","priority queue"],"author":{"name":"Daniel Lemire","email":"lemire@gmail.com","url":"http://lemire.me/en/"},"license":"Apache-2.0","bugs":{"url":"https://github.com/lemire/StablePriorityQueue.js/issues"},"homepage":"https://github.com/lemire/StablePriorityQueue.js#readme","dependencies":{},"devDependencies":{"benchmark":"^1.0.0","mocha":"^2.3.4"},"gitHead":"e3e3c7d63f44184f92257822499768d28af6c2cb","_id":"stablepriorityqueue@0.1.0","_shasum":"130999d55a6c07ee843d9fb246d1dcb801437bd0","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.1","_npmUser":{"name":"lemire","email":"lemire@gmail.com"},"dist":{"shasum":"130999d55a6c07ee843d9fb246d1dcb801437bd0","tarball":"https://registry.npmjs.org/stablepriorityqueue/-/stablepriorityqueue-0.1.0.tgz","integrity":"sha512-Nd6xCQkvJsX1F+rEpe754hiK5GwkcSDS1ZioNfe4m+/M2TU+aJCIwIn3Mqd3YePwLdBYye+sTPAYVSvjIETsPQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBngoPbtwnJDxAFOInz8wCB3oUfIBKAqepT34P3fT9qyAiEApzT/sO1fx4M/bccn6D5x3DnLa/GDPp3e0YKpTTONyh0="}]},"maintainers":[{"name":"lemire","email":"lemire@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/stablepriorityqueue-0.1.0.tgz_1489428236097_0.9011231008917093"},"directories":{}},"0.1.1":{"name":"stablepriorityqueue","version":"0.1.1","description":"A stable heap-based priority queue in JavaScript","main":"StablePriorityQueue.js","scripts":{"test":"mocha unit/basictests.js"},"repository":{"type":"git","url":"git+https://github.com/lemire/StablePriorityQueue.js.git"},"keywords":["heap","binary heap","data structure","priority queue"],"author":{"name":"Daniel Lemire","email":"lemire@gmail.com","url":"http://lemire.me/en/"},"license":"Apache-2.0","bugs":{"url":"https://github.com/lemire/StablePriorityQueue.js/issues"},"homepage":"https://github.com/lemire/StablePriorityQueue.js#readme","dependencies":{},"devDependencies":{"benchmark":"^1.0.0","mocha":"^2.3.4"},"gitHead":"b4582e71fbb0744f3fb84a3a462660bc26909fa7","_id":"stablepriorityqueue@0.1.1","_npmVersion":"6.4.1","_nodeVersion":"10.11.0","_npmUser":{"name":"lemire","email":"lemire@gmail.com"},"dist":{"integrity":"sha512-qfFjGm+ydl1sbGwdOkVZhqnRYsKPpGYFn63QvivPlsYcMM2J6ckkcwbWXDzTYHC8OlST73d4NkIZngC2QYJliw==","shasum":"1d6fc248496d55ed7fe33669b1aa7c9045defae5","tarball":"https://registry.npmjs.org/stablepriorityqueue/-/stablepriorityqueue-0.1.1.tgz","fileCount":6,"unpackedSize":24306,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbsmBHCRA9TVsSAnZWagAAp3UP/A63BgFOLlmJyJmxAQn4\n1Wt52HkelgHvSftYl3xkSz799idPS8C690hglbu4eUEpKrMVilpI7SQlbdY7\np0YoDEWmqDu02XV5eK1+bEjC/cImRvfVx59zaXADBclo7WOhuz/h7b+WdPvj\nLJui/seHzXa54GcJjzh/f1adGmiJKXOV1KyTTvWLk6pOPQKy91YPCRumFgcs\n8VvREI0S5Ma4Hvy6Hu23kK+oSrsNxmz64+uhExYL9dLqhyyYujPi39L0/2lI\nvbXdycPvDfhKt1ihncdlHlYkuti2B7ZWCl8V2o31eT4TrdP0VprH91mEvbYU\npqZ+szdlwe+S2B1R/YGiVXrGSXgzu9Tx/Xy5RLVl7ete6P0XImAN/LkA8L/u\noLejgW4qqDX4pkhwK4U4NlkCQkvOMt5RHNytoXBctMTve963Fm+APGfEKkTA\n5MTKN/8HPjvZSTF2S+Zs6yYhVSqBjfrGnOBvgOjTKpueIxQPedNvb4W51r1E\n6uu27tMvmMRKbmTi9Ntr321n0OncmqSwyZxbBI7xYWXy9pwGF0dcoolFJL6R\nr5UeH/BKtP4FQ+sGfp/IplsIGt//ILfh6hVW3zj7vwe/SVyMY5uaK/vCyfNn\nglFxyClFemdhM66xrjfqvz/D88aHHYYhpuE6UlsbxiTgOR1moB0CFOK/ua2T\nfz4m\r\n=J1bs\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFPHj0kg5wZR+qJKa9NNPG/6Shgxza4nvMXeMUnP/IlkAiEAt5HxvRP3zPg3DnW/aBl8lOeuY/sycrqDUs/fZZnBmGA="}]},"maintainers":[{"name":"lemire","email":"lemire@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stablepriorityqueue_0.1.1_1538416711126_0.6742356647177319"},"_hasShrinkwrap":false},"0.1.2":{"name":"stablepriorityqueue","version":"0.1.2","description":"A stable heap-based priority queue in JavaScript","main":"StablePriorityQueue.js","scripts":{"test":"mocha unit/basictests.js"},"repository":{"type":"git","url":"git+https://github.com/lemire/StablePriorityQueue.js.git"},"keywords":["heap","binary heap","data structure","priority queue"],"author":{"name":"Daniel Lemire","email":"lemire@gmail.com","url":"http://lemire.me/en/"},"license":"Apache-2.0","bugs":{"url":"https://github.com/lemire/StablePriorityQueue.js/issues"},"homepage":"https://github.com/lemire/StablePriorityQueue.js#readme","dependencies":{},"devDependencies":{"benchmark":"^1.0.0","mocha":"^2.3.4"},"gitHead":"4cd847cb93cae050f87b6dddba8d2252f947ac6d","_id":"stablepriorityqueue@0.1.2","_npmVersion":"6.4.1","_nodeVersion":"10.11.0","_npmUser":{"name":"lemire","email":"lemire@gmail.com"},"dist":{"integrity":"sha512-7lyQFMunStfqwa8+8955BwbFLTB9eHX798oPxw0EBh3GgmgTBOp6NaTfuwQ0hOZ0GrJUh77jcdveoXSKMWLEmQ==","shasum":"f3339fb35eeca480d1c685a4cbe5abae06714ca0","tarball":"https://registry.npmjs.org/stablepriorityqueue/-/stablepriorityqueue-0.1.2.tgz","fileCount":6,"unpackedSize":24306,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbsmENCRA9TVsSAnZWagAAtusP/1DzuUDwZoFydXqKtvca\nP7npKfknVzVCS5kfLTb/9FQOJ8xm+kiqOwJ1WG/j2+L1PvaV4iKzBRkdgDMw\n6fQkJhMQwOdN4loUt3EKhiAAt7LmNzKIRCC3pzu6b3Asu4uGzZoV3InGA7uL\nTX77qdMPoCMrlHTPZk+U1ZkTEUnNL0YWW47kHlML4rtWWOVRGNxpHFp2Mal7\nmVSNs9DCVcSsxuqrkjGw4jgc1YrDv/nckaccvJVFimw6oyRcQFW141zb+Zbx\nuJ6hTsq7NYKEX6kIExfNMmCyo5tddDM3DYMx9SfvDFMJHhaWMlewQxzkEDtA\nkqsLsNif6seQbWRlyjaCUt3Qg3Q6jEDX+280+lJLizwKmCIgBkoHFqOEpdhe\n+miCeHpFB+/Ty8+4YBfHfol7vMncUZ2kh35tbSkg2pYxTx5WRkGus78E4ABL\nwViBMHraPf6bl/M2H2qamxLlYjwvTf5+rQnh0w5AAXhavs5yLuVvb9LjJYMJ\nOVp44L2mvlmb8jwNKswbb7U35WaCvB2tHmTwd4r5WkU2pEpo8RnT25smQxLm\nQlYSDcuhkUl9cYp+d83SdWdizwrnuwRRZo5jmavAhOntsE0rv1N1IhmqEkU5\nR9Rq3xRgVbscAXugPMkwy0gzTu2xFzDw86JZchE3qW7dYCuXrqXz5w2/zP70\nJ6Tv\r\n=PohE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDtpP1u/NUbNQhHbeks2HnKqwQ2lM43Cno4h1YQM0scaAIhANm3j7N73JlTVvaLc96YNvfAppqdFshSToit3QAmR6nZ"}]},"maintainers":[{"name":"lemire","email":"lemire@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/stablepriorityqueue_0.1.2_1538416908519_0.6944416092980346"},"_hasShrinkwrap":false}},"readme":"# StablePriorityQueue.js\n[![Build Status](https://travis-ci.org/lemire/StablePriorityQueue.js.svg?branch=master)](https://travis-ci.org/lemire/StablePriorityQueue.js)\n\nA stable heap-based priority queue in JavaScript\n\nIn a priority queue, you can...\n\n- query or remove (poll) the smallest element quickly\n- insert elements quickly\n\nIn practice, \"quickly\" often means in logarithmic time (O(log n)).\n\nA heap can be used to implement a priority queue.\n\nStablePriorityQueue is an attempt to implement a priority queue\nin JavaScript that is stable. That is, when equal values are inserted, it will always poll the oldest of the equal values.\n\nLicense: Apache License 2.0\n\nUsage\n===\n\n```javascript\nvar x = new StablePriorityQueue();\nx.add(1);\nx.add(0);\nx.add(5);\nx.add(4);\nx.add(3);\nx.peek(); // should return 0, leaves x unchanged\nx.size; // should return 5, leaves x unchanged\nwhile(!x.isEmpty()) {\n  console.log(x.poll());\n} // will print 0 1 3 4 5\nx.trim(); // (optional) optimizes memory usage\n```\n\nYou can also provide the constructor with a comparator function.\n\n\n```javascript\nvar x = new StablePriorityQueue(function(a,b) {return b - a});\nx.add(1);\nx.add(0);\nx.add(5);\nx.add(4);\nx.add(3);\nwhile(!x.isEmpty()) {\n  console.log(x.poll());\n} // will print 5 4 3 1 0\n```\n\nor\n\n\n```javascript\nvar x = new StablePriorityQueue(function(a, b) {\n      return a.energy - b.energy;\n});\n[{ name: 'player', energy: 10},\n { name: 'monster1', energy: 10},\n { name: 'monster2', energy: 10},\n { name: 'monster3', energy: 10}\n].forEach(function(o){\n      x.add(o);\n})\nwhile (!x.isEmpty()) {\n    console.log(x.poll());\n}\n// will output:\n//{ name: 'player', energy: 10 }\n//{ name: 'monster1', energy: 10 }\n//{ name: 'monster2', energy: 10 }\n//{ name: 'monster3', energy: 10 }\n```\n\n\nIf you are using node.js, you need to import the module:\n\n```javascript\nvar StablePriorityQueue = require(\"stablepriorityqueue\");\nvar b = new StablePriorityQueue();// initially empty\nb.add(1);// add the value \"1\"\n```\nnpm install\n===\n\n      $ npm install stablepriorityqueue\n\nComputational complexity\n===\n\nThe function calls \"add\" and \"poll\" have logarithmic complexity with respect\nto the size of the data structure (attribute size). Looking at the top value\nis a constant time operation.\n\n\n\nTesting\n===\n\nUsing node.js (npm), you can test the code as follows...\n\n      $ npm install mocha\n      $ npm test\n\nYou might also like...\n===\n\nIf you like this library, you might also like\n- https://github.com/lemire/FastBitSet.js\n- https://github.com/lemire/FastPriorityQueue.js\n","maintainers":[{"name":"lemire","email":"lemire@gmail.com"}],"time":{"modified":"2022-06-26T23:37:53.219Z","created":"2017-03-13T18:03:56.737Z","0.1.0":"2017-03-13T18:03:56.737Z","0.1.1":"2018-10-01T17:58:31.311Z","0.1.2":"2018-10-01T18:01:48.850Z"},"homepage":"https://github.com/lemire/StablePriorityQueue.js#readme","keywords":["heap","binary heap","data structure","priority queue"],"repository":{"type":"git","url":"git+https://github.com/lemire/StablePriorityQueue.js.git"},"author":{"name":"Daniel Lemire","email":"lemire@gmail.com","url":"http://lemire.me/en/"},"bugs":{"url":"https://github.com/lemire/StablePriorityQueue.js/issues"},"license":"Apache-2.0","readmeFilename":"README.md"}