From Jason Turner

[alg.is_permutation]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpn4pwk0ad/{from.md → to.md} +0 -44
tmp/tmpn4pwk0ad/{from.md → to.md} RENAMED
@@ -1,44 +0,0 @@
1
- ### Is permutation <a id="alg.is_permutation">[[alg.is_permutation]]</a>
2
-
3
- ``` cpp
4
- template<class ForwardIterator1, class ForwardIterator2>
5
- bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
6
- ForwardIterator2 first2);
7
- template<class ForwardIterator1, class ForwardIterator2,
8
- class BinaryPredicate>
9
- bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
10
- ForwardIterator2 first2, BinaryPredicate pred);
11
- template<class ForwardIterator1, class ForwardIterator2>
12
- bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
13
- ForwardIterator2 first2, ForwardIterator2 last2);
14
- template<class ForwardIterator1, class ForwardIterator2,
15
- class BinaryPredicate>
16
- bool is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
17
- ForwardIterator2 first2, ForwardIterator2 last2,
18
- BinaryPredicate pred);
19
- ```
20
-
21
- *Requires:* `ForwardIterator1` and `ForwardIterator2` shall have the
22
- same value type. The comparison function shall be an equivalence
23
- relation.
24
-
25
- *Remarks:* If `last2` was not given in the argument list, it denotes
26
- `first2 + (last1 - first1)` below.
27
-
28
- *Returns:* If `last1 - first1 != last2 - first2`, return `false`.
29
- Otherwise return `true` if there exists a permutation of the elements in
30
- the range \[`first2`, `first2 + (last1 - first1)`), beginning with
31
- `ForwardIterator2 begin`, such that `equal(first1, last1, begin)`
32
- returns `true` or `equal(first1, last1, begin, pred)` returns `true`;
33
- otherwise, returns `false`.
34
-
35
- *Complexity:* No applications of the corresponding predicate if
36
- `ForwardIterator1` and `ForwardIterator2` meet the requirements of
37
- random access iterators and `last1 - first1 != last2 - first2`.
38
- Otherwise, exactly `last1 - first1` applications of the corresponding
39
- predicate if `equal(first1, last1, first2, last2)` would return `true`
40
- if `pred` was not given in the argument list or
41
- `equal(first1, last1, first2, last2, pred)` would return `true` if pred
42
- was given in the argument list; otherwise, at worst 𝑂(N^2), where N has
43
- the value `last1 - first1`.
44
-