-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce lower_bound_n and upper_bound_n, improve inplace_merge (#169)
The inplace_merge algorithm that works for forward iterators when no heap memory is available was passing next(i, n) to upper_bound and lower_bound while both of those start by computing the size again from the passed iterators. Introducing lower_bound_n and upper_bound_n avoids to cross the subrange twice to compute information we already have. This change makes the forward iterator version of merge_sort way faster than it used to be when no heap memory is available.
- Loading branch information
Showing
3 changed files
with
32 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters