IMP: min improvement/shortcut
This commit is contained in:
parent
12f71c5d7e
commit
7d349c57cb
@ -329,8 +329,15 @@ namespace algo {
|
||||
template<typename T, typename Comparator>
|
||||
static auto split(std::vector<T> data, Comparator cmp, int depth, int &num_threads,
|
||||
std::mutex &mut) -> std::vector<T>{
|
||||
|
||||
if (data.size() <= 1) {
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user