"Batch" partial sorting algorithm I'm looking for an existing algorithm that would ensure that the first k elements after sorting are the top k elements but not necessarily in the right order.
To put it differently, I would like an algorithm that acts like C++ std::partial_sort but takes advantage of the fact that I don't need the first elements ordered.
If there's no such thing yet, I'm planning on studying again existing algorithms and try to find out which one would be the best candidate to tweak. Any lead would be welcome.
What I was looking for is a selection algorithm that will select the k-th element.
As mentioned in comment, running then a simple partition algorithm if needed will then provide the expected result.
The reference seems to be the quick select algorithm while the reference implementation points to introselect as implemented in Numpy's partition function or C++ nth_element function.