Skip to content

Commit

Permalink
Implement binarySort with rotateRight
Browse files Browse the repository at this point in the history
  • Loading branch information
Morwenn committed Jan 27, 2024
1 parent 7ee9139 commit 0be56ef
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions include/gfx/timsort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,8 @@ class TimSort {
}
for (; start < hi; ++start) {
GFX_TIMSORT_ASSERT(lo <= start);
auto pivot = std::ranges::iter_move(start);

auto pos = std::ranges::upper_bound(lo, start, std::invoke(proj, pivot), comp, proj);
for (iter_t p = start; p > pos; --p) {
*p = std::ranges::iter_move(std::ranges::prev(p));
}
*pos = std::move(pivot);
auto pos = std::ranges::upper_bound(lo, start, std::invoke(proj, *start), comp, proj);
rotateRight(pos, std::ranges::next(start));
}
}

Expand Down

0 comments on commit 0be56ef

Please sign in to comment.