Skip to content

Commit d133c22

Browse files
committed
Fix definition of MOPs
1 parent 87ca147 commit d133c22

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/Measures-of-presortedness.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Measures of presortedness were formally defined by H. Mannila in *Measures of pr
1111
> 1. If *X* is sorted, then *M*(*X*) = 0
1212
> 2. If *X* and *Y* are order isomorphic, then *M*(*X*) = *M*(*Y*)
1313
> 3. If *X* is a subset of *Y*, then *M*(*X*) ≤ *M*(*Y*)
14-
> 4. If every element of *X* is smaller than every element of *Y*, then *M*(*X.Y*) ≤ *M*(*X*) + *M*(*Y*)
15-
> 5. *M*({*x*}.*X*) ≤ |*X*| + *M*(*X*) for every natural integer *X*
14+
> 4. If every element of *X* is smaller than every element of *Y*, then *M*(*XY*) ≤ *M*(*X*) + *M*(*Y*)
15+
> 5. *M*(*x**X*) ≤ |*X*| + *M*(*X*) for every element *x* of the domain
1616
17-
A few measures of presortedness described in the research papers actually return 1 when *X* is already sorted, thus violating the first property above. We implement these measures in a such way that they return 0 instead, generally by subtracting 1 from the result of the described operation.
17+
A few measures of presortedness described in the research papers actually return 1 when *X* is already sorted, thus violating the first property above. We implement those measures in a such way that they return 0 instead, generally by subtracting 1 from the result of the described operation.
1818

1919
### Partial ordering of measures of presortedness
2020

@@ -47,7 +47,7 @@ auto c = probe::ham(li, std::greater<>{});
4747
auto d = probe::runs(integers, std::negate<>{});
4848
```
4949

50-
Note however that these algorithms can be expensive. Using them before an actual sorting algorithm little interest if any. They are instead meant to be profiling tools: when sorting is a critical part of your application, you can use these measures on typical data and check whether it is mostly sorted according to one measure or another, then you may be able to find a sorting algorithm known to be optimal with regard to this specific measure.
50+
Note however that most of these algorithms can be expensive. Using them before an actual sorting algorithm has little interest if any. They are instead meant to be profiling tools: when sorting is a critical part of your application, you can use these measures on typical data and check whether it is mostly sorted according to one measure or another, then you may be able to find a sorting algorithm known to be optimal with regard to this specific measure.
5151

5252
Measures of presortedness can be used with the *sorter adapters* from the library. Even though most of the adapters are meaningless with measures of presortedness, some of them can still be used to mitigate space and time:
5353

@@ -59,7 +59,7 @@ auto inv = cppsort::indirect_adapter<decltype(cppsort::probe::inv)>{};
5959
auto inv = cppsort::indirect_adapter(cppsort::probe::inv);
6060
```
6161

62-
All measures of presortedness live in the subnamespace `cppsort::probe`. Even though all of them are available in their own header, it is possible to include all of them at once with the following include:
62+
All measures of presortedness live in the subnamespace `cppsort::probe`. Even though all of them are available in their own header, it is still possible to include all of them at once with the following include:
6363

6464
```cpp
6565
#include <cpp-sort/probes.h>
@@ -75,13 +75,13 @@ static constexpr auto max_for_size(Integer n)
7575
-> Integer;
7676
```
7777
78-
It takes an integer `n` and returns the maximum value that the measure of presortedness might return for a collection of size `n`.
78+
It takes an integer `n` and returns the maximum value that the measure of presortedness can return for a collection of size `n`.
7979
8080
*New in version 1.10.0*
8181
8282
## Available measures of presortedness
8383
84-
Measures of presortedness are pretty formalized, so the names of the functions in the library are short and correspond to the ones used in the literature.
84+
Measures of presortedness are pretty formalized, so the names of the functions in the library are short and generally correspond to the ones used in the literature.
8585
8686
In the following descriptions we use *X* to represent the input sequence, and |*X*| to represent the size of that sequence.
8787

0 commit comments

Comments
 (0)