{"_id":"quickselect","_rev":"3331481","name":"quickselect","description":"A tiny and fast selection algorithm in JavaScript.","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"time":{"modified":"2024-07-10T07:21:51.000Z","created":"2016-02-17T12:45:13.399Z","3.0.0":"2024-07-03T09:18:32.790Z","2.0.0":"2018-04-04T12:30:12.541Z","1.1.1":"2018-04-04T12:25:04.581Z","1.1.0":"2018-04-03T12:21:36.932Z","1.0.1":"2017-12-21T09:30:40.277Z","1.0.0":"2016-02-17T12:45:13.399Z"},"users":{"shanewholloway":true},"author":{"name":"Vladimir Agafonkin"},"repository":{"type":"git","url":"git+https://github.com/mourner/quickselect.git"},"versions":{"3.0.0":{"name":"quickselect","version":"3.0.0","type":"module","description":"A tiny and fast selection algorithm in JavaScript.","repository":{"type":"git","url":"git+https://github.com/mourner/quickselect.git"},"module":"index.js","main":"index.js","exports":"./index.js","devDependencies":{"eslint":"^9.6.0","eslint-config-mourner":"^4.0.1","esm":"^3.2.25","rollup":"^4.18.0","tape":"^5.8.1","typescript":"^5.5.3"},"scripts":{"pretest":"eslint *.js && tsc","test":"node test.js","bench":"node bench.js"},"types":"index.d.ts","keywords":["selection","algorithm","quickselect","sort","partial","floyd","rivest"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","_id":"quickselect@3.0.0","gitHead":"c26429fd0a6f7b63b48a269e04748c34e8c0c5f4","bugs":{"url":"https://github.com/mourner/quickselect/issues"},"homepage":"https://github.com/mourner/quickselect#readme","_nodeVersion":"20.14.0","_npmVersion":"10.8.0","dist":{"shasum":"a37fc953867d56f095a20ac71c6d27063d2de603","size":2206,"noattachment":false,"key":"/quickselect/-/quickselect-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/quickselect/download/quickselect-3.0.0.tgz"},"_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"directories":{},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/quickselect_3.0.0_1719998312530_0.8824770315142825"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-07-03T09:18:32.790Z","publish_time":1719998312790,"_source_registry_name":"default","_cnpm_publish_time":1719998312790},"2.0.0":{"name":"quickselect","version":"2.0.0","description":"A tiny and fast selection algorithm in JavaScript.","module":"index.js","main":"quickselect.js","dependencies":{},"devDependencies":{"eslint":"^4.19.1","eslint-config-mourner":"^2.0.3","esm":"^3.0.15","rollup":"^0.57.1","tape":"^4.9.0"},"eslintConfig":{"extends":"mourner","parserOptions":{"sourceType":"module"}},"scripts":{"pretest":"eslint index.js test.js bench.js","test":"node -r esm test.js","bench":"node -r esm bench.js","build":"rollup -c","prepublishOnly":"npm run build"},"files":["index.js","quickselect.js"],"keywords":["selection","algorithm","quickselect","sort","partial","floyd","rivest"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","gitHead":"85e11e63085274f28dab80e8134175f6ff1807c3","_id":"quickselect@2.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.0","_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"dist":{"shasum":"f19680a486a5eefb581303e023e98faaf25dd018","size":2247,"noattachment":false,"key":"/quickselect/-/quickselect-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/quickselect/download/quickselect-2.0.0.tgz"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/quickselect_2.0.0_1522845012444_0.07345593570731324"},"_hasShrinkwrap":false,"publish_time":1522845012541,"_cnpm_publish_time":1522845012541},"1.1.1":{"name":"quickselect","version":"1.1.1","description":"A tiny and fast selection algorithm in JavaScript.","main":"quickselect.js","dependencies":{},"devDependencies":{"eslint":"^4.19.1","eslint-config-mourner":"^2.0.3","esm":"^3.0.15","rollup":"^0.57.1","tape":"^4.9.0"},"eslintConfig":{"extends":"mourner","parserOptions":{"sourceType":"module"}},"scripts":{"pretest":"eslint index.js test.js bench.js","test":"node -r esm test.js","bench":"node -r esm bench.js","build":"rollup -c","prepublishOnly":"npm run build"},"files":["index.js","quickselect.js"],"keywords":["selection","algorithm","quickselect","sort","partial","floyd","rivest"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","gitHead":"c8b997fbd5fbbdca42307e738adefa7476cd5abe","_id":"quickselect@1.1.1","_npmVersion":"5.6.0","_nodeVersion":"8.11.0","_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"dist":{"shasum":"852e412ce418f237ad5b660d70cffac647ae94c2","size":2243,"noattachment":false,"key":"/quickselect/-/quickselect-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/quickselect/download/quickselect-1.1.1.tgz"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/quickselect_1.1.1_1522844704524_0.477885608881943"},"_hasShrinkwrap":false,"publish_time":1522844704581,"_cnpm_publish_time":1522844704581},"1.1.0":{"name":"quickselect","version":"1.1.0","description":"A tiny and fast selection algorithm in JavaScript.","module":"index.js","main":"quickselect.js","dependencies":{},"devDependencies":{"eslint":"^4.19.1","eslint-config-mourner":"^2.0.3","esm":"^3.0.15","rollup":"^0.57.1","tape":"^4.9.0"},"eslintConfig":{"extends":"mourner","parserOptions":{"sourceType":"module"}},"scripts":{"pretest":"eslint index.js test.js bench.js","test":"node -r esm test.js","bench":"node -r esm bench.js","build":"rollup -c","prepublishOnly":"npm run build"},"files":["index.js","quickselect.js"],"keywords":["selection","algorithm","quickselect","sort","partial","floyd","rivest"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","gitHead":"26aaa258c2f57195d0b1d43a16894fef1c0c459b","_id":"quickselect@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.0","_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"dist":{"shasum":"d09205c7eb52762c81e02c967d123694fb843108","size":2246,"noattachment":false,"key":"/quickselect/-/quickselect-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/quickselect/download/quickselect-1.1.0.tgz"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/quickselect_1.1.0_1522758096806_0.22573084392681886"},"_hasShrinkwrap":false,"publish_time":1522758096932,"_cnpm_publish_time":1522758096932},"1.0.1":{"name":"quickselect","version":"1.0.1","description":"A tiny and fast selection algorithm in JavaScript.","main":"index.js","dependencies":{},"devDependencies":{"eslint":"^2.1.0","eslint-config-mourner":"^2.0.0","tape":"^4.4.0"},"scripts":{"pretest":"eslint index.js test.js","test":"tape test.js"},"keywords":["selection","algorithm","quickselect","sort","partial","floyd","rivest"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","gitHead":"631efe5734122190d480ba394bde96f5bcd70e3e","_id":"quickselect@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"9.2.0","_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"dist":{"shasum":"1e6ceaa9db1ca7c75aafcc863c7bef2037ca62a1","size":1759,"noattachment":false,"key":"/quickselect/-/quickselect-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/quickselect/download/quickselect-1.0.1.tgz"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/quickselect-1.0.1.tgz_1513848639385_0.11995588219724596"},"directories":{},"publish_time":1513848640277,"_hasShrinkwrap":false,"_cnpm_publish_time":1513848640277},"1.0.0":{"name":"quickselect","version":"1.0.0","description":"A tiny and fast selection algorithm in JavaScript.","main":"index.js","dependencies":{},"devDependencies":{"eslint":"^2.1.0","eslint-config-mourner":"^2.0.0","tape":"^4.4.0"},"scripts":{"pretest":"eslint index.js test.js","test":"tape test.js"},"keywords":["selection","algorithm","quickselect","sort","partial","floyd","rivest"],"author":{"name":"Vladimir Agafonkin"},"license":"ISC","gitHead":"f6ca6ce8bb412772ade017d2c78d38d74ef8070e","_id":"quickselect@1.0.0","_shasum":"02630818f9aae4ecab26f0103f98d061c17c58f3","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.6.0","_npmUser":{"name":"mourner","email":"agafonkin@gmail.com"},"dist":{"shasum":"02630818f9aae4ecab26f0103f98d061c17c58f3","size":1537,"noattachment":false,"key":"/quickselect/-/quickselect-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/quickselect/download/quickselect-1.0.0.tgz"},"maintainers":[{"name":"mourner","email":"agafonkin@gmail.com"}],"_npmOperationalInternal":{"host":"packages-5-east.internal.npmjs.com","tmp":"tmp/quickselect-1.0.0.tgz_1455713109131_0.2091331349220127"},"directories":{},"publish_time":1455713113399,"_cnpm_publish_time":1455713113399,"_hasShrinkwrap":false}},"readme":"## quickselect\n\nA tiny and fast [selection algorithm](https://en.wikipedia.org/wiki/Selection_algorithm) in JavaScript\n(specifically, [Floyd-Rivest selection](https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm)).\n\n```js\nquickselect(array, k[, left, right, compareFn]);\n```\n\nRearranges items so that all items in the `[left, k]` are the smallest.\nThe `k`-th element will have the `(k - left + 1)`-th smallest value in `[left, right]`.\n\n- `array`: the array to partially sort (in place)\n- `k`: middle index for partial sorting (as defined above)\n- `left`: left index of the range to sort (`0` by default)\n- `right`: right index (last index of the array by default)\n- `compareFn`: compare function\n\nExample:\n\n```js\nconst arr = [65, 28, 59, 33, 21, 56, 22, 95, 50, 12, 90, 53, 28, 77, 39];\n\nquickselect(arr, 8);\n\n// arr is [39, 28, 28, 33, 21, 12, 22, 50, 53, 56, 59, 65, 90, 77, 95]\n//                                         ^^ middle index\n```\n","_attachments":{},"homepage":"https://github.com/mourner/quickselect#readme","bugs":{"url":"https://github.com/mourner/quickselect/issues"},"license":"ISC"}