fix
This commit is contained in:
parent
c8a3a6d4e3
commit
23a02e9dd1
@ -5,6 +5,7 @@
|
||||
#include <chrono>
|
||||
|
||||
#include <mergesort.h>
|
||||
#include <mergesort_mt.h>
|
||||
|
||||
/*
|
||||
Create a simple sorting application that uses the mergesort algorithm to sort a
|
||||
@ -98,7 +99,7 @@ auto main(int argc, char *argv[]) -> int {
|
||||
|
||||
return 0;
|
||||
|
||||
} catch (std::exception e) {
|
||||
} catch (std::exception &e) {
|
||||
fmt::print("Error occured: {}", e.what());
|
||||
return -1;
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ namespace algo {
|
||||
|
||||
while (l < left.end() && r < right.end()) {
|
||||
if (cmp(*l, *r)) {
|
||||
outpbufut.insert(o, *l);
|
||||
output.insert(o, *l);
|
||||
l++;
|
||||
} else {
|
||||
output.insert(o, *r);
|
||||
|
@ -11,13 +11,13 @@ class MergeSorterMT {
|
||||
|
||||
auto merge(std::span<T> &output, std::span<T> left, std::span<T> right) -> void {
|
||||
std::vector<T> buf;
|
||||
buf.reserver(left.size() + right.size());
|
||||
buf.reserve(left.size() + right.size());
|
||||
|
||||
auto l = left.begin();
|
||||
auto r = right.begin();
|
||||
auto o = buf.begin();
|
||||
|
||||
hile (l < left.end() && r < right.end()) {
|
||||
while (l < left.end() && r < right.end()) {
|
||||
if (cmp(*l, *r)) {
|
||||
buf.insert(o, *l);
|
||||
l++;
|
||||
@ -44,5 +44,11 @@ class MergeSorterMT {
|
||||
}
|
||||
}
|
||||
|
||||
auto split(std::vector<T> &data, C cmp, int depth, int &max_depth, std::mutex &mut) -> void {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
Loading…
Reference in New Issue
Block a user