3 ms·
Yes, this is exactly what the author is trying to port to Python. Mandatory reference link: http://en.cppreference.com/w/cpp/algorithm/nth_element http://en.cp
by nly 13y ago
Yes, this is exactly what the author is trying to port to Python.
Mandatory reference link: http://en.cppreference.com/w/cpp/algorithm/nth_element http://en.cppreference.com/w/cpp/algorithm/nth_element . Note linear complexity.
There's also std::partial_sort:
http://en.cppreference.com/w/cpp/algorithm/partial_sort http://en.cppreference.com/w/cpp/algorithm/partial_sort