Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3736c3f
CI: upgrade actions/checkout to v6
Morwenn Jan 18, 2026
f0d68ea
Mention mirrors in the release checklist
Morwenn Jan 18, 2026
b219e30
Documentation: fix missing and useless link references
Morwenn Jan 18, 2026
ccf3b51
Smaller sorting network for 26 inputs
Morwenn Jan 23, 2026
a037194
Update sorting_network_sorter with latest results from SorterHunter
Morwenn Jan 23, 2026
d3e229a
Add test section for total_greater
Morwenn Jan 25, 2026
0cfb2b5
Use std::strong_order for total_less and total_greater when possible
Morwenn Jan 25, 2026
9ea5a28
Fix weak_less and weak_greater with floating-point numbers
Morwenn Feb 11, 2026
46243d1
Test new conjecture about Exc and Inv
Morwenn Mar 1, 2026
f365ae5
Mark [weak/partial]_[less/greater] fallbacks constexpr
Morwenn Mar 1, 2026
be3ed7f
Fix partial_less and partial_greater with floating-point numbers
Morwenn Mar 1, 2026
158b7bd
Test that M(Unique(X))=M(X) for Amp, Mono, Runs
Morwenn Mar 13, 2026
bb6526b
Test that M(Unique(X))=M(X) for Block, Enc, SUS
Morwenn Mar 16, 2026
9aacbb9
Rollback Block(Unique(X)) = Block(X) test
Morwenn Jun 3, 2026
4e23968
Upgrade downloaded Catch2 version to v3.15.0
Morwenn Jun 3, 2026
19ee7d4
Floor integer divisions in doc of measures of disorder
Morwenn Jun 28, 2026
438745c
CI: upgrade actions/checkout to v7
Morwenn Aug 1, 2026
4621e67
New measure of disorder: Reve
Morwenn Jul 25, 2026
d8dab90
Tests: add missing amp/reve to move tests
Morwenn Aug 1, 2026
c3bcd9b
Move Unique & Reversed probe tests to a common file
Morwenn Aug 1, 2026
342eb8e
Doc: add an illustration for Mono
Morwenn Aug 1, 2026
0788bf1
Test partial/weak/greater comparators over integers
Morwenn Aug 1, 2026
bfa7458
Upgrade downloaded Catch2 version to v3.15.3
Morwenn Aug 1, 2026
d97471a
Doc: small improvements around measures of disorder
Morwenn Aug 1, 2026
89a7ea1
CI: get rid of CMake warning in MSVC builds
Morwenn Aug 23, 2026
0c478dc
Doc: update benchmark for measures of disorder
Morwenn Aug 23, 2026
28dc96d
Preparing release 2.2.0
Morwenn Aug 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .forgejo/workflows/deploy-to-wiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:

steps:
- name: Checkout /docs
uses: actions/checkout@v6
uses: actions/checkout@v7
with:
repository: ${{forgejo.repository}}
path: main

- name: Checkout wiki
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
repository: ${{forgejo.repository}}.wiki
path: wiki
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2025 Morwenn
# Copyright (c) 2021-2026 Morwenn
# SPDX-License-Identifier: MIT

name: MacOS Builds
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
sanitize: address,undefined

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- uses: rui314/setup-mold@v1

- name: Configure CMake
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-mingw.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2025 Morwenn
# Copyright (c) 2021-2026 Morwenn
# SPDX-License-Identifier: MIT

name: MinGW-w64 Builds
Expand Down Expand Up @@ -31,7 +31,7 @@ jobs:
build_type: [Debug, Release]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Configure CMake
shell: pwsh
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build-msvc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2025 Morwenn
# Copyright (c) 2021-2026 Morwenn
# SPDX-License-Identifier: MIT

name: MSVC Builds
Expand Down Expand Up @@ -36,15 +36,14 @@ jobs:
build_tools: '-T ClangCL'

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Configure CMake
shell: pwsh
working-directory: ${{runner.workspace}}
run: |
cmake -H${{github.event.repository.name}} -Bbuild `
-DCMAKE_CONFIGURATION_TYPES=${{matrix.config.build_type}} `
-DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} `
-G"Visual Studio 17 2022" -A x64 ${{matrix.config.build_tools}} `
-DCPPSORT_BUILD_TESTING=ON `
-DCPPSORT_BUILD_EXAMPLES=ON
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2025 Morwenn
# Copyright (c) 2021-2026 Morwenn
# SPDX-License-Identifier: MIT

name: Ubuntu Builds
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
sanitize: address,undefined

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- uses: rui314/setup-mold@v1

- name: Install GCC
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2025 Morwenn
# Copyright (c) 2020-2026 Morwenn
# SPDX-License-Identifier: MIT

name: Coverage Upload to Codecov
Expand All @@ -22,7 +22,7 @@ jobs:

steps:
- name: Checkout project
uses: actions/checkout@v4
uses: actions/checkout@v7
- uses: rui314/setup-mold@v1

- name: Install LCOV
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-to-wiki.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2025 Morwenn
# Copyright (c) 2020-2026 Morwenn
# SPDX-License-Identifier: MIT

name: Wiki Deployment
Expand All @@ -19,13 +19,13 @@ jobs:

steps:
- name: Checkout /docs
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
repository: ${{github.repository}}
path: main

- name: Checkout wiki
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
repository: ${{github.repository}}.wiki
path: wiki
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mirror-to-codeberg.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2025 Morwenn
# Copyright (c) 2025-2026 Morwenn
# SPDX-License-Identifier: MIT

name: Mirror Commits to Codeberg
Expand All @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v7
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.11.0)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

project(cpp-sort VERSION 2.1.0 LANGUAGES CXX)
project(cpp-sort VERSION 2.2.0 LANGUAGES CXX)

include(CMakePackageConfigHelpers)
include(cpp-sort-utils)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![cpp-sort logo](docs/images/cpp-sort-logo.svg)

[![Latest Release](https://img.shields.io/badge/release-2.1.0-blue.svg)](https://codeberg.org/Morwenn/cpp-sort/releases/tag/v2.1.0)
[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F2.1.0-blue.svg)](https://conan.io/center/recipes/cpp-sort?version=2.1.0)
[![Latest Release](https://img.shields.io/badge/release-2.2.0-blue.svg)](https://codeberg.org/Morwenn/cpp-sort/releases/tag/v2.2.0)
[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F2.2.0-blue.svg)](https://conan.io/center/recipes/cpp-sort?version=2.2.0)
[![Code Coverage](https://codecov.io/gh/Morwenn/cpp-sort/branch/2.x.y-develop/graph/badge.svg)](https://codecov.io/gh/Morwenn/cpp-sort)
[![Pitchfork Layout](https://img.shields.io/badge/standard-PFL-orange.svg)](https://github.com/vector-of-bool/pitchfork)

Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class CppSortConan(ConanFile):
name = "cpp-sort"
version = "2.1.0"
version = "2.2.0"
description = "Sorting algorithms & related tools"
license = "MIT"
url = "https://codeberg.org/Morwenn/cpp-sort"
Expand Down
8 changes: 4 additions & 4 deletions docs/Benchmarks.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
*Note: this page only benchmarks sorting algorithms under specific conditions. It can be used as a quick guide but if you really need a fast algorithm for a specific use case, you better run your own benchmarks.*

*Last meaningful updates:*
* *2.1.0 for measures of disorder*
* *2.2.0 for measures of disorder*
* *1.16.0 for slow O(n log n) sorts*
* *1.14.0 for small array sorts*
* *1.13.1 for unstable random-access sorts, forward sorts, and the expensive move/cheap comparison benchmark*
Expand All @@ -14,7 +14,7 @@ It is worth noting that most benchmarks on this page use collections of `double`
All of the graphs on this page have been generated with slightly modified versions of the scripts found in the project's benchmarks folder. There are just too many things to check; if you ever want a specific benchmark, don't hesitate to ask for it.

*The benchmarks were run on:*
* *For version 2.0.0 and newer: EndeavourOS with g++ 15.2, with the flags -O3 -march=native -std=c++26.*
* *For version 2.0.0 and newer: EndeavourOS with g++ 16.2, with the flags -O3 -march=native -std=c++26.*
* *For older versions: Windows 10 with 64-bit MinGW-w64 g++ 12.0, with the flags -O3 -march=native -std=c++20.*

# Random-access collections
Expand Down Expand Up @@ -176,10 +176,10 @@ We can see several trends in these benchmarks, rather consistant across `int` an

This benchmark for [measures of disorder][Measures-of-disorder] is small and only intends to show the cost that these tools might incur. It is not meant to be exhaustive in any way.

![Benchmark speed of measures of disorder for increasing size for std::vector<int>](https://i.imgur.com/uGoVIcE.png)
![Benchmark speed of measures of disorder for increasing size for std::vector<int>](https://i.imgur.com/xOJIhm1.png)

It makes rather easy to see the different groups of complexities:
* *Amp(X)*, *Runs(X)* and *Mono(X)* are obvious O(n) algorithms.
* *Amp(X)*, *Reve(X)*, *Runs(X)* and *Mono(X)* are obvious O(n) algorithms.
* *Dis(X)* is a more involved O(n) algorithm.
* All of the other measures of disorder run in O(n log n) time.

Expand Down
8 changes: 7 additions & 1 deletion docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ While **cpp-sort** theoretically requires a fully C++17-compliant compiler, a fe

When compiled with C++20, **cpp-sort** might gain a few additional features depending on the level of C++20 support provided by the compiler. The availability of those features depends on the presence of corresponding [feature-testing macros][feature-test-macros] when possible, even though some checks are more granular. Don't hesitate to open an issue if your compiler and standard library supports one of those features but it doesn't seem to work in **cpp-sort**.

**Correctness improvements:**
* When possible, the total order predicates [`total_less` and `total_greater`][total-greater-less] use [`std::strong_order`][std-strong-order] to compare floating-point numbers, leading to a supposedly correct implementation of the IEEE *totalOrder* operator. In C++17 and earlier, those comparators don't actually implement a proper total order: they are unable to differentiate between quiet and signaling NaNs, and connot read NaN payloads.

The feature-test macro `__cpp_lib_three_way_comparison` can be used to check whether `std::strong_order` is available.

**New features:**
* When available, [`std::identity`][std-identity] benefits from dedicated support wherever [`utility::identity`][cpp-sort-function-objects] is supported, with equivalent semantics.

Expand Down Expand Up @@ -44,12 +49,13 @@ When compiled with C++20, **cpp-sort** might gain a few additional features depe
[feature-test-macros]: https://wg21.link/SD6
[pdq-sorter]: Sorters.md#pdq_sorter
[ska-sorter]: Sorters.md#ska_sorter
[sorter-facade]: Sorter-facade.md
[std-greater-void]: https://en.cppreference.com/w/cpp/utility/functional/greater_void
[std-identity]: https://en.cppreference.com/w/cpp/utility/functional/identity
[std-less-void]: https://en.cppreference.com/w/cpp/utility/functional/less_void
[std-mem-fn]: https://en.cppreference.com/w/cpp/utility/functional/mem_fn
[std-ranges-greater]: https://en.cppreference.com/w/cpp/utility/functional/ranges/greater
[std-ranges-less]: https://en.cppreference.com/w/cpp/utility/functional/ranges/less
[std-strong-order]: https://en.cppreference.com/w/cpp/utility/compare/strong_order
[std-swap]: https://en.cppreference.com/w/cpp/algorithm/swap
[total-greater-less]: Comparators.md#total-order-comparators
[utility-iter-move]: Miscellaneous-utilities.md#iter_move-and-iter_swap
9 changes: 6 additions & 3 deletions docs/Comparators.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Every non-refined comparator described below is also a [transparent comparator][
#include <cpp-sort/comparators/total_less.h>
```

The comparators `total_less` and `total_order` are [customization points][custom-point] implementing a [total order][total-order], inspired by the similar functions described in [P0100][P0100]. The provided functions handle built-in integer out of the box (using the built-in relational operators) and implement IEEE 754's `totalOrder` for floating point numbers (from lesser to greater):
The comparators `total_less` and `total_order` are [customization points][custom-point] implementing a [total order][total-order], inspired by the similar functions described in [P0100][P0100]. The provided functions handle built-in integer types out of the box (using the built-in relational operators) and attempt to implement IEEE 754's `totalOrder` for floating point numbers (from lesser to greater):
* positive quiet NaNs
* positive signaling NaNs
* positive infinity
Expand All @@ -21,10 +21,14 @@ The comparators `total_less` and `total_order` are [customization points][custom
* negative signaling NaNs
* negative quiet NaNs

That said, the comparators are currently unable to discriminate between quiet and signaling NaNs, so they are considered to be *equivalent*. When it doesn't handle a type natively and ADL doesn't find any suitable `total_less` function in a class namespace, `cppsort::total_less` does *not* fall back to `operator<`; see [P0100][P0100] for the rationale (it applies to the whole `total_*` family of customization points).
That said, the comparators are unable to discriminate between quiet and signaling NaNs, and have no way to inspect the bit patterns of NaNs to compare them. All NaNs that share a same sign are therefore considered to be *equivalent* in C++17. In C++20 however, the comparators rely on [`std::strong_order`][std-strong-order] when available, which correctly implements `totalOrder` for IEEE 754 floating point numbers.

When it doesn't handle a type natively and ADL doesn't find any suitable `total_less` function in a class namespace, `cppsort::total_less` does *not* fall back to `operator<`; see [P0100][P0100] for the rationale (it applies to the whole `total_*` family of customization points).

Total order comparators are considered as [generating branchless code][branchless-traits] when comparing instances of a type that satisfies [`std::is_integral`][std-is-integral].

*Changed in version 2.1.0:* `total_less` and `total_greater` now correctly implement IEEE 754 `totalOrder` in C++20 mode, when the featur-test macro `__cpp_lib_three_way_comparison` is defined.

### Weak order comparators

```cpp
Expand Down Expand Up @@ -99,7 +103,6 @@ The two-parameter version of the customization point calls the three-parameter o

[binary-predicate]: https://en.cppreference.com/w/cpp/named_req/BinaryPredicate
[branchless-traits]: Miscellaneous-utilities.md#branchless-traits
[callable]: https://en.cppreference.com/w/cpp/named_req/Callable
[case-sensitivity]: https://en.wikipedia.org/wiki/Case_sensitivity
[cppcon2015-compare]: https://github.com/CppCon/CppCon2015/tree/master/Presentations/Comparison%20is%20not%20simple%2C%20but%20it%20can%20be%20simpler
[custom-point]: https://ericniebler.com/2014/10/21/customization-point-design-in-c11-and-beyond/
Expand Down
2 changes: 1 addition & 1 deletion docs/Fixed-size-sorters.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Size | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16
:-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-:
**CEs** | 0 | 1 | 3 | 5 | 9 | 12 | 16 | 19 | 25 | 29 | 35 | 39 | 45 | 51 | 56 | 60
**Size** | **17** | **18** | **19** | **20** | **21** | **22** | **23** | **24** | **25** | **26** | **27** | **28** | **29** | **30** | **31** | **32**
**CEs** | 71 | 77 | 85 | 91 | 99 | 106 | 114 | 120 | 130 | 139 | 147 | 155 | 164 | 172 | 180 | 185
**CEs** | 71 | 77 | 85 | 91 | 99 | 106 | 114 | 120 | 130 | 138 | 147 | 155 | 164 | 172 | 180 | 185
**Size** | **33** | **34** | **35** | **36** | **37** | **38** | **39** | **40** | **41** | **42** | **43** | **44** | **45** | **46** | **47** | **48**
**CEs** | 199 | 209 | 220 | 227 | 240 | 250 | 259 | 265 | 282 | 291 | 303 | 309 | 324 | 332 | 340 | 346
**Size** | **49** | **50** | **51** | **52** | **53** | **54** | **55** | **56** | **57** | **58** | **59** | **60** | **61** | **62** | **63** | **64**
Expand Down
2 changes: 1 addition & 1 deletion docs/Home.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![cpp-sort logo](images/cpp-sort-logo.svg)

Welcome to the **cpp-sort 2.1.0** documentation!
Welcome to the **cpp-sort 2.2.0** documentation!

This wiki contains documentation about the library: basic documentation about the many sorting tools and how to use them, documentation about the additional utilities provided by the library, as well as a few tutorials about writing your own sorters or sorter adapters. This main page explains a few general things that didn't quite fit in other parts of the documentation.

Expand Down
39 changes: 33 additions & 6 deletions docs/Measures-of-disorder.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,12 @@ Where $N_{\mathit{eq}}(X)$ is the number of pairs of neighbors that compare equi
| ----------- | ----------- | ------------- | --------- |
| n | 1 | Forward | No |

`max_for_size`: $\lvert X \rvert - 2$ when the sign of $comp$ changes for every pair of neighbors.
`max_for_size`: $\lvert X \rvert - 2$ for [zigzag permutations][zigzag-permutation].

**Note:** *Amp* does not respect Mannila's criterion 4: $\mathit{Amp}(\langle 1, 2, 3 \rangle) = 0$ and $\mathit{Amp}(\langle 6, 5, 4 \rangle) = 0$, but $\mathit{Amp}(\langle 1, 2, 3, 6, 5, 4 \rangle) = 4$.

*New in version 2.1.0*

### *Block*

```cpp
Expand Down Expand Up @@ -236,7 +238,7 @@ $$
| ----------- | ----------- | ------------- | --------- |
| n log n | n | Forward | No |

`max_for_size`: $\frac{\lvert X \rvert}{2}$ when all values extracted from $X$ are within the bounds of already extracted encroaching lists (for example the sequence $\langle 10, 0, 9, 1, 8, 2, 7, 3, 6, 4, 5 \rangle$ triggers the worst case).
`max_for_size`: $\lfloor \frac{\lvert X \rvert}{2} \rfloor$ when all values extracted from $X$ are within the bounds of already extracted encroaching lists (for example the sequence $\langle 10, 0, 9, 1, 8, 2, 7, 3, 6, 4, 5 \rangle$ triggers the worst case).

### *Exc*

Expand Down Expand Up @@ -290,7 +292,7 @@ Computes the number of inversions in $X$, where an inversion corresponds to a pa
| ----------- | ----------- | ------------- | --------- |
| n log n | n | Forward | Yes |

`max_for_size`: $\frac{\lvert X \rvert(\lvert X \rvert - 1)}{2}$ when $X$ is sorted in reverse order.
`max_for_size`: $\lfloor \frac{\lvert X \rvert(\lvert X \rvert - 1)}{2} \rfloor$ when $X$ is sorted in reverse order.

### *Max*

Expand Down Expand Up @@ -318,11 +320,13 @@ The measure of disorder is slightly different from its original description in [
* It subtracts 1 from the number of runs, thus returning 0 when $X$ is sorted.
* It explicitly handles non-increasing and non-decreasing runs, not only the strictly increasing or decreasing ones.

![Illustration of Mono showing how a sequence of integers can be split into monotonic runs](images/measure-of-disorder-mono.png)

| Complexity | Memory | Iterators | Monotonic |
| ----------- | ----------- | ------------- | --------- |
| n | 1 | Forward | No |

`max_for_size`: $\frac{\lvert X \rvert + 1}{2} - 1$ when $X$ is a sequence of elements that are alternatively greater then lesser than their previous neighbour.
`max_for_size`: $\lfloor \frac{\lvert X \rvert + 1}{2} \rfloor - 1$ for [zigzag permutations][zigzag-permutation] (but not only those).

**Note:** `probe::mono` does not respect Mannila's criterion 4: $\mathit{Mono}(\langle 1, 2, 3, 4, 5 \rangle) = 0$ and $\mathit{Mono}(\langle 10, 9, 8, 7, 6 \rangle) = 0$, but $\mathit{Mono}(\langle 1, 2, 3, 4, 5, 10, 9, 8, 7, 6 \rangle) = 1$.

Expand Down Expand Up @@ -366,6 +370,26 @@ Computes the minimum number of elements that must be removed from $X$ to obtain

`max_for_size`: $\lvert X \rvert - 1$ when $X$ is sorted in reverse order.

### *Reve*

```cpp
#include <cpp-sort/probes/reve.h>
```

The number of reversals in the growth direction of a sequence.

![Illustration showing a line diagram of a sequence of integer numbers, highlighting the inflection points in the growth direction](images/measure-of-disorder-reve.png)

| Complexity | Memory | Iterators | Monotonic |
| ----------- | ----------- | ------------- | --------- |
| n | 1 | Forward | No |

`max_for_size`: $\lvert X \rvert - 2$ for [zigzag permutations][zigzag-permutation].

**Note:** `probe::reve` does not respect Mannila's criterion 4: $\mathit{Reve}(\langle 1, 2, 3, 4, 5 \rangle) = 0$ and $\mathit{Reve}(\langle 10, 9, 8, 7, 6 \rangle) = 0$, but $\mathit{Reve}(\langle 1, 2, 3, 4, 5, 10, 9, 8, 7, 6 \rangle) = 1$.

*New in version 2.2.0*

### *Runs*

```cpp
Expand All @@ -392,9 +416,11 @@ Spearman's footrule distance: sum of distances between the position of individua
| ----------- | ----------- | ------------- | --------- |
| n log n | n | Forward | Yes |

`max_for_size`: $\frac{\lvert X \rvert²}{2}$ when $X$ is sorted in reverse order.
`max_for_size`: $\lfloor \frac{\lvert X \rvert^2}{2} \rfloor$ when $X$ is sorted in reverse order.

**Note:** *Spear* does not respect Mannila's criterion 5: $\mathit{Spear}(\langle 4, 1, 2, 3 \rangle) \not \le \lvert \langle 4 \rangle \rvert + \mathit{Spear}(\langle 1, 2, 3 \rangle)$.

**Note:** *Spear* does not respect Mannila's criterion 5: $\mathit{Spear}(\langle 4, 1, 2, 3 \rangle) \not \le \lvert \langle 1, 2, 3 \rangle \rvert + \mathit{Spear}(\langle 1, 2, 3 \rangle)$.
**Note²:** $\lfloor \frac{\mathit{Spear}(X)}{2} \rfloor$ respects Mannila's criterion 5, and is a proper measure of presortedness. A future version of **cpp-sort** might replace the current implementation with one that halves its result.

### *SUS*

Expand Down Expand Up @@ -473,3 +499,4 @@ Nevertheless we do know a few of the measure's properties:
[probe-sms]: Measures-of-disorder.md#sms
[probe-sus]: Measures-of-disorder.md#sus
[sort-race]: https://arxiv.org/ftp/arxiv/papers/1609/1609.04471.pdf
[zigzag-permutation]: https://en.wikipedia.org/wiki/Alternating_permutation
1 change: 0 additions & 1 deletion docs/Miscellaneous-utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ assert(not cppsort::utility::check_strict_weak_ordering(vec, std::less{});)
[std-greater]: https://en.cppreference.com/w/cpp/utility/functional/greater
[std-greater-void]: https://en.cppreference.com/w/cpp/utility/functional/greater_void
[std-identity]: https://en.cppreference.com/w/cpp/utility/functional/identity
[std-integer-sequence]: https://en.cppreference.com/w/cpp/utility/integer_sequence
[std-integral-constant]: https://en.cppreference.com/w/cpp/types/integral_constant
[std-invoke]: https://en.cppreference.com/w/cpp/utility/functional/invoke
[std-is-arithmetic]: https://en.cppreference.com/w/cpp/types/is_arithmetic
Expand Down
Loading
Loading