3.0.0 • Published 5 months ago

quickselect v3.0.0

Weekly downloads
743,616
License
ISC
Repository
github
Last release
5 months 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-gl@openmapvn/maplibre-glgrid-likelg-mapbox-glkt-maplibre-glkarn-mapkarn-mapbox-glmaplibre-gl-reduce-functionalitiesmaplibre-gl-tdtsdmaplibre-glmaplibre-gl-ashmapsi-glmapglvmapmagic-glmapbox-gl-custom-layermapbox-glmapbox-gl--custom-stretchmapbox-gl-ahtmapbox-gl-encryptedmapbox-gl-epsg4490mapbox-gl-js-with-shapesmapbox-gl-kyemapbox-gl-mapmagicmapbox-gl-mbtilesmapbox-gl-mdorymapbox-gl-htmapbox-gl-hxmapbox-gl-tdtsdmapbox-gl-testmapbox-gl-testingmapbox-gl-tultmapbox-with-shapesp-mapbox-glpbf-basic-renderpetr-maplibre-glrbushrbush-3drbush-extrif-mapbox-glrpd-mapbox-glucsc-xena-vivtrackasia-gl@americana/maplibre-gl@appearhere/mapbox-gl@ark-org/map@autoxing/mapbox-gl@alantgeo/mapbox-gl@bcherny/mapbox-gl@bestest/math@bewithjonam/mapbox-gl@carto/mapbox-gl@cczbby/mapbox-gl@cczbby/maplibre-gl@cgcs2000/mapbox-gl@3drobotics/mapbox-gl@0xfa11/maplibre-gl@dfw810/mapbox-glxyd-mapbox-glzelibobla-vivxtal-gl@felix5/mapbox-webgl2@gvol-org/mapbox-gl@hansdo/maplibre-gl@hubmap/vitessce-image-viewer@goongmaps/goong-js@geops/maplibre-gl@geomatico/mapbox-gl@globalfishingwatch/mapbox-gl@globalfishingwatch/maplibre-gl@krisdages/mapbox-gl@koordinates/maplibre-gl@loadmill/universal@loonride/rbush@luqh_mapbox/mapbox-gl@maps-gl/maps-gl@maptalks/vector-packer@maptalks/vt@mapcat/mapbox-gl@mapcat/mapcat-gl@mapgis/mapbox-gl@maplibre/maplibre-gl-style-spec@emuanalytics/maplibre-gl@mapbox/mapbox-gl-style-spec@jingsam/mapbox-gl@ivelander/mapbox-gl
3.0.0

5 months ago

2.0.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

9 years ago