3#include <AH/STL/algorithm>
5#include <AH/STL/cstdint>
31template <u
int8_t N,
class T =
float>
70 const uint8_t halfSize = N / 2 + 1;
71 std::array<T, halfSize> sorted;
73 sorted.begin(), sorted.end());
81 return (sorted.end()[-2] + sorted.end()[-1]) / 2;
83 return sorted.end()[-1];
110template <u
int8_t N,
class T =
float>
151 auto halfWay = sorted.begin() + N / 2;
152 std::nth_element(sorted.begin(), halfWay, sorted.end());
159 auto beforeHalfWay = std::max_element(sorted.begin(), halfWay);
160 return (*halfWay + *beforeHalfWay) / 2;