Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quickselect

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quickselect

A tiny and fast selection algorithm in JavaScript.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.2M
increased by16.36%
Maintainers
1
Weekly downloads
 
Created

What is quickselect?

The quickselect npm package is a fast selection algorithm implementation for JavaScript, based on Tony Hoare's quickselect algorithm. It allows for efficiently selecting the k-th smallest element from an unsorted list without fully sorting the array. This can be particularly useful in applications where partial sorting is sufficient, such as finding the median or other order statistics in a dataset.

What are quickselect's main functionalities?

Selecting the k-th smallest element

This feature allows you to rearrange the array so that the element at the k-th position is the one that would be in that position if the array were sorted. The elements before it are smaller, and the elements after it are larger. This is useful for finding specific order statistics, such as the median, in linear time.

const quickselect = require('quickselect');
let arr = [5, 3, 7, 6, 2, 9];
quickselect(arr, 2);
console.log(arr[2]); // Outputs: 5

Other packages similar to quickselect

Keywords

FAQs

Package last updated on 21 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc