Library with the (some of) best known strategies for the K-nht smallest element in an array/sequence.
Might come handy for other algorithms that require median finding such as a KD-tree and others.
The only strategy so far is the implementation of Quickselect with random pivot which is O(n) on average. Sorting and finding the middle element would be O(n logn) usually. It changes the input array so you should clone it before if this is an issue.
I can related to that as I was paid most of my professional life to be a kitchen programmer and the most complex software I've written had academic or personal motivation... But indeed, this project is a very specific algorithm.
I just released a better version of quickselect with median of medians.
I wanted to compare a pure nim implementation with an implemtation that used the nim/C++ interop. Soon I post it here