Min/Max selection
version 1.15.0.0 (20.5 KB) by
Bruno Luong
Search for k smallest or largest elements in the array
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 LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.