Skip to content

Select k-th lowest value from a single-topology array

Notifications You must be signed in to change notification settings

cristiancavalli/quick-select

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

JS Quick-Select

Select k-th lowest value from a single topology array. Adapted with <3 for fun from: http://www.techiedelight.com/quickselect-algorithm/

Use

const quickSelect = require('./quick-select/index');
const myArray = [5, 10, 0, 18, 3];
// Defaults to selecting smallest
const smallest = quickSelect(myArray);    // Returns 0
// May supply k-th smallest as param for selection
const second = quickSelect(myArray, 1);   // Returns 3

About

Select k-th lowest value from a single-topology array

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published