Min/Max selection

version 1.15.0.0 (20.5 KB) by Bruno Luong
Search for k smallest or largest elements in the array

8K Downloads

Updated Fri, 20 May 2016 11:50:14 +0000

View License

Using a partial quick-sort algorithm implemented with C-MEX. The complexity is O(n + k.log(k)), where n is the size of the array, and k is the number of elements to be selected.
Faster than SORT or multiple call of MIN/MAX for large size inputs.
Multidimensional capability supported

Cite As

Bruno Luong (2022). Min/Max selection (https://www.mathworks.com/matlabcentral/fileexchange/23576-min-max-selection), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2006b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!