IMP: min improvement/shortcut

This commit is contained in:
Robin Dietzel 2023-11-02 22:13:49 +01:00
parent 12f71c5d7e
commit 7d349c57cb

View File

@ -329,8 +329,15 @@ namespace algo {
template<typename T, typename Comparator> template<typename T, typename Comparator>
static auto split(std::vector<T> data, Comparator cmp, int depth, int &num_threads, static auto split(std::vector<T> data, Comparator cmp, int depth, int &num_threads,
std::mutex &mut) -> std::vector<T>{ std::mutex &mut) -> std::vector<T>{
if (data.size() <= 1) { if (data.size() <= 1) {
return data; return data;
} else if (data.size() == 2) {
if(cmp(data[0], data[1])) {
return std::vector<T> {data[0], data[1]};
} else {
return std::vector<T> {data[1], data[0]};
}
} }
std::vector<T> output; std::vector<T> output;