3.0.0 • Published 1 year ago

quickselect v3.0.0

Weekly downloads
743,616
License
ISC
Repository
github
Last release
1 year ago

quickselect

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:

const 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-gltest-map-azsftwrvwake_jsx-mapbox-glswsk-mapboxglthinknetmapsvnmapvizzuality-mapbox-glvicapow-mapbox-glvietmap-glvietmaps-glkarn-mapkarn-mapbox-glkt-maplibre-gllg-mapbox-glmapbox-glmapbox-gl--custom-stretchmapbox-gl-ahtmapbox-gl-custom-layermapbox-gl-tdtsdmapbox-gl-testmapbox-gl-testingmapbox-gl-tultmapbox-gl_wstdmapbox-gl-encryptedmapbox-gl-epsg4490mapbox-gl-js-with-shapesmapbox-gl-kyemapglvmapmetrics-glmapmetrics-gl-testmaplibre-gl-reduce-functionalitiesmaplibre-gl-tdtsdmaplibre-glmaplibre-gl-ashmapbox-gl-mdorymapbox-gl-mapmagicmapbox-gl-mbtilesmapbox-with-shapesmapbox-gl-htmapbox-gl-hxmapmagic-glmapsi-gl@windfish-studio/rbush-ext@windycom/maplibre-gl@webdeb/mapbox-gl@xbcx/mapbox-gl@tssu/mapbox-gl@tommy2gis/maplibre-gl@tommy2gis/maplibre-gl-style-spec@tommy2gis/swsk-mapbox-gl@trackasia/trackasia-gl-style-spec@vivjs-experimental/loaders@vivjs/loaders@vwake_vg/frontend-logger@vitaly.varyvdin/maplibre-gl@xll/mapbox-gl@yongju/maplibre-gl@xyflow/rbush@xt-plugins/mapbox-gl@zzes/mapbox-glanthonyhull-mapbox-glanother-mapmagic-glark-map@goongmaps/goong-js@hansdo/maplibre-gl@gvol-org/mapbox-gl@openmapvn/maplibre-glucsc-xena-vivtrackasia-gl@bestest/math@bewithjonam/mapbox-gl@carto/mapbox-gl@cczbby/mapbox-gl@cczbby/maplibre-gl@cgcs2000/mapbox-glxyd-mapbox-glzelibobla-vivxtal-gl@loadmill/universal@loonride/rbush@porsager/mapbox-glp-mapbox-glocmappbf-basic-renderrpd-mapbox-glrbush-extrbushrbush-3dpetr-maplibre-glrif-mapbox-glgrid-likecheaper-mapbox-gl-with-referrer-policycomments-mapdanamap-gl
3.0.0

1 year ago

2.0.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

10 years ago