Compare commits

..

2 Commits

Author SHA1 Message Date
2665332f70 fix execution 2023-12-05 22:36:19 +01:00
a47714d8b6 fix execution 2023-12-05 22:36:06 +01:00

View File

@ -3,6 +3,7 @@
#include <thread>
#include <mutex>
#include <functional>
#include <assert.h>
template<typename T>
class QuickSorterMT {
@ -49,8 +50,7 @@ private:
return;
}
}
auto pivot = data[std::distance(data.begin(), data.end()) / 2];
auto pivot = *std::next(data.begin(), std::distance(data.begin(), data.end()) / 2);
auto m1 = std::partition(data.begin(), data.end(), [pivot, this](const auto &em) {
return this->cmp(em, pivot);
@ -61,7 +61,7 @@ private:
});
auto left = data.subspan(0, m1 - data.begin());
auto right = data.subspan(m2 - data.begin(), data.size());
auto right = data.subspan(m2 - data.begin());
if (depth < mdepth) {
std::thread left_thread([&]() { qsort(left, depth + 1, mdepth); });