2.0.0 • Published 6 years ago

quickselect v2.0.0

Weekly downloads
743,616
License
ISC
Repository
-
Last release
6 years ago

quickselect Build Status

A tiny and fast selection algorithm in JavaScript (specifically, Floyd-Rivest selection).

quickselect(array, k[, left, right, compareFn]);

Rearranges items so that all items in the [left, k] are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right].

  • array: the array to partially sort (in place)
  • k: middle index for partial sorting (as defined above)
  • left: left index of the range to sort (0 by default)
  • right: right index (last index of the array by default)
  • compareFn: compare function

Example:

var arr = [65, 28, 59, 33, 21, 56, 22, 95, 50, 12, 90, 53, 28, 77, 39];

quickselect(arr, 8);

// arr is [39, 28, 28, 33, 21, 12, 22, 50, 53, 56, 59, 65, 90, 77, 95]
//                                         ^^ middle index
@simosol/mapbox-gl-js-offlinebst-map-gl@mapcreator/mapbox-gl@saeon/ol-react@everything-registry/sub-chunk-2515@langge-data/mapbox-glgrid-like@ogix/mapbox-gl@onthegomap/mapbox-gl@sakitam-gis/rbush@sakitam-gis/mapbox-gl@shitao1988/swsk-mapbox-gl@shitao1988/swsk-mapbox-gl-js@pirxpilot/mapbox-gl@plotly/mapbox-gl@porsager/mapbox-gl@tommy2gis/swsk-mapbox-glkarn-mapkarn-mapbox-glkt-maplibre-gl@bestest/math@bewithjonam/mapbox-gl@autoxing/mapbox-gl@ark-org/map@bcherny/mapbox-gl@vivjs/loaders@curio/mapbox-glcheaper-mapbox-gl-with-referrer-policyark-map@appearhere/mapbox-gl@webdeb/mapbox-gl@3drobotics/mapbox-gl@cgcs2000/mapbox-glmapbox-gl-encryptedmapbox-gl-epsg4490mapbox-gl-htmapbox-gl-js-with-shapesmapbox-gl-kyemapbox-gl-tdtsdmapbox-gl-testmapbox-gl-testingmapbox-gl-tultmapbox-gl-mapmagicmapbox-gl-mbtilesmapbox-gl-mdorymapbox-gl-custom-layermapbox-with-shapesmaplibre-glmaplibre-gl-ashmaplibre-gl-reduce-functionalitiesmapmagic-glmaplibre-gl-tdtsd@windfish-studio/rbush-ext@windycom/maplibre-glmapsi-glmapbox-glmapbox-gl--custom-stretchmapbox-gl-aht@xt-plugins/mapbox-gl@xll/mapbox-gl@xbcx/mapbox-gl@yongju/maplibre-gl@tssu/mapbox-glanother-mapmagic-glanthonyhull-mapbox-glpbf-basic-renderdmap-glrbushrbush-3drbush-extp-mapbox-glpetr-maplibre-glcomments-mapdingi-glrif-mapbox-glrpd-mapbox-gl@carto/mapbox-gl@cczbby/mapbox-gl@cczbby/maplibre-gl@dfw810/mapbox-glxtal-glxyd-mapbox-glthinknetmapsucsc-xena-viv@emuanalytics/maplibre-gl@felix5/mapbox-webgl2vnmapvietmap-glvietmaps-glvicapow-mapbox-gltrackasia-glvizzuality-mapbox-gl@hansdo/maplibre-glf-mapbox-glswsk-mapboxglzelibobla-viv@inelo/maplibre-glx-mapbox-gl@geomatico/mapbox-gl@geops/maplibre-gl
2.0.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

8 years ago