-
-
Save danlark1/9e3216cad1dc854c56b9cace1dd87677 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::vector<int> values = { /* more than 10 values */ }; | |
std::nth_element(values.begin(), values.begin() + 9, values.end()); | |
int tenth_element = values[9]; | |
std::vector<int> values = { /* more than 10 values */ }; | |
std::partial_sort(values.begin(), values.begin() + 10, values.end()); | |
int tenth_element = values[9]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment