{"id":17918796,"url":"https://github.com/mourner/quickselect","last_synced_at":"2025-04-07T05:06:54.528Z","repository":{"id":47452193,"uuid":"51921734","full_name":"mourner/quickselect","owner":"mourner","description":"A fast selection algorithm in JavaScript.","archived":false,"fork":false,"pushed_at":"2024-09-24T09:16:48.000Z","size":69,"stargazers_count":87,"open_issues_count":3,"forks_count":17,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T04:03:42.732Z","etag":null,"topics":["algorithm","floyd-rivest","javascript","quickselect","selection","sort"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mourner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-17T12:42:17.000Z","updated_at":"2025-01-04T10:56:13.000Z","dependencies_parsed_at":"2024-11-29T23:00:18.885Z","dependency_job_id":null,"html_url":"https://github.com/mourner/quickselect","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mourner%2Fquickselect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mourner%2Fquickselect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mourner%2Fquickselect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mourner%2Fquickselect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mourner","download_url":"https://codeload.github.com/mourner/quickselect/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247595332,"owners_count":20963943,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","floyd-rivest","javascript","quickselect","selection","sort"],"created_at":"2024-10-28T20:12:52.767Z","updated_at":"2025-04-07T05:06:54.509Z","avatar_url":"https://github.com/mourner.png","language":"JavaScript","readme":"## quickselect [![Node](https://github.com/mourner/quickselect/actions/workflows/node.yml/badge.svg)](https://github.com/mourner/quickselect/actions/workflows/node.yml) [![Simply Awesome](https://img.shields.io/badge/simply-awesome-brightgreen.svg)](https://github.com/mourner/projects)\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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmourner%2Fquickselect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmourner%2Fquickselect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmourner%2Fquickselect/lists"}