Last active
April 25, 2022 20:55
-
-
Save rygorous/7736f58738a1b8343244928df3502dea to your computer and use it in GitHub Desktop.
Mwahaha
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
#include <stdio.h> | |
#include <float.h> | |
#include <math.h> | |
#include <algorithm> | |
int main() | |
{ | |
constexpr size_t count = 20; | |
float vals[count] = | |
{ | |
1.f, 2.f, 3.f, 4.f, NAN, | |
1.f, 2.f, 3.f, 4.f, NAN, | |
1.f, 2.f, 3.f, 4.f, NAN, | |
1.f, 2.f, 3.f, 4.f, NAN, | |
}; | |
//std::sort(vals, vals + count); | |
//std::stable_sort(vals, vals + count); | |
std::partial_sort(vals, vals + count, vals + count); | |
for (size_t i = 0; i < count; ++i) | |
printf("[%2d] %f\n", (int)i, vals[i]); | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment