From 56ad45ccc0bdba7afc32c84b8c340b7cbf0c5815 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Sat, 2 Nov 2024 09:38:51 +0800 Subject: [PATCH] [algorithms, numerics] Replace "exactly" with "at most" in Complexity --- source/algorithms.tex | 84 +++++++++++++++++++++---------------------- source/numerics.tex | 4 +-- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/source/algorithms.tex b/source/algorithms.tex index e635672012..b3d1ff0661 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -3631,7 +3631,7 @@ \pnum \complexity -Applies \tcode{f} exactly \tcode{last - first} times. +Applies \tcode{f} at most \tcode{last - first} times. \pnum \remarks @@ -3662,7 +3662,7 @@ \pnum \complexity -Applies \tcode{f} exactly \tcode{last - first} times. +Applies \tcode{f} at most \tcode{last - first} times. \pnum \remarks @@ -3707,7 +3707,7 @@ \pnum \complexity -Applies \tcode{f} and \tcode{proj} exactly \tcode{last - first} times. +Applies \tcode{f} and \tcode{proj} at most \tcode{last - first} times. \pnum \remarks @@ -4172,7 +4172,7 @@ \pnum \complexity For the overloads with no \tcode{ExecutionPolicy}, -exactly \[ \min(\tcode{(i - first) + 1}, \ \tcode{(last - first) - 1}) \] +at most \[ \min(\tcode{(i - first) + 1}, \ \tcode{(last - first) - 1}) \] applications of the corresponding predicate, where \tcode{i} is \tcode{adjacent_find}'s return value. For the overloads with an \tcode{ExecutionPolicy}, @@ -4246,7 +4246,7 @@ \pnum \complexity -Exactly \tcode{last - first} applications +At most \tcode{last - first} applications of the corresponding predicate and any projection. \end{itemdescr} @@ -4520,7 +4520,7 @@ if \tcode{ForwardIterator1} and \tcode{Forward\-Iter\-ator2} meet the requirements of random access iterators and \tcode{last1 - first1 != last2 - first2}. -Otherwise, exactly \tcode{last1 - first1} applications +Otherwise, at most \tcode{last1 - first1} applications of the corresponding predicate if \tcode{equal(first1, last1, first2, last2, pred)} would return \tcode{true}; otherwise, at worst \bigoh{N^2}, where $N$ has the value \tcode{last1 - first1}. @@ -4570,7 +4570,7 @@ \tcode{R1} and \tcode{R2} each model \libconcept{sized_range}, and \tcode{ranges::distance(r1) != ranges::distance(r2)}. \end{itemize} -Otherwise, exactly \tcode{last1 - first1} applications +Otherwise, at most \tcode{last1 - first1} applications of the corresponding predicate and projections if \tcode{ranges::equal(\brk{}first1, last1, first2, last2, pred, proj1, proj2)} would return \tcode{true}; @@ -5056,7 +5056,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \indexlibraryglobal{copy}% @@ -5086,7 +5086,7 @@ \pnum \complexity -Exactly \tcode{last - first} assignments. +At most \tcode{last - first} assignments. \end{itemdescr} \indexlibraryglobal{copy_n}% @@ -5132,7 +5132,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \indexlibraryglobal{copy_if}% @@ -5202,7 +5202,7 @@ \pnum \complexity -Exactly \tcode{last - first} applications +At most \tcode{last - first} applications of the corresponding predicate and any projection. \pnum @@ -5261,7 +5261,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \rSec2[alg.move]{Move} @@ -5319,7 +5319,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \indexlibrary{\idxcode{move}!algorithm}% @@ -5352,7 +5352,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \indexlibraryglobal{move_backward}% @@ -5414,7 +5414,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \rSec2[alg.swap]{Swap} @@ -5484,7 +5484,7 @@ \pnum \complexity -Exactly $M$ swaps. +At most $M$ swaps. \end{itemdescr} \indexlibraryglobal{iter_swap}% @@ -5626,7 +5626,7 @@ \pnum \complexity -Exactly $N$ applications of \tcode{op} or \tcode{binary_op}, and +At most $N$ applications of \tcode{op} or \tcode{binary_op}, and any projections. This requirement also applies to the overload with an \tcode{ExecutionPolicy}. @@ -5710,7 +5710,7 @@ \pnum \complexity -Exactly \tcode{last - first} applications +At most \tcode{last - first} applications of the corresponding predicate and any projection. \end{itemdescr} @@ -5821,7 +5821,7 @@ \pnum \complexity -Exactly \tcode{last - first} applications +At most \tcode{last - first} applications of the corresponding predicate and any projection. \end{itemdescr} @@ -5878,7 +5878,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \rSec2[alg.generate]{Generate} @@ -5932,7 +5932,7 @@ \pnum \complexity -Exactly $N$ evaluations of \tcode{gen()} and assignments. +At most $N$ evaluations of \tcode{gen()} and assignments. \end{itemdescr} \rSec2[alg.remove]{Remove} @@ -6008,7 +6008,7 @@ \pnum \complexity -Exactly \tcode{last - first} applications +At most \tcode{last - first} applications of the corresponding predicate and any projection. \pnum @@ -6118,7 +6118,7 @@ \pnum \complexity -Exactly \tcode{last - first} applications +At most \tcode{last - first} applications of the corresponding predicate and any projection. \pnum @@ -6193,7 +6193,7 @@ \pnum \complexity -For nonempty ranges, exactly \tcode{(last - first) - 1} applications +For nonempty ranges, at most \tcode{(last - first) - 1} applications of the corresponding predicate and no more than twice as many applications of any projection. \end{itemdescr} @@ -6308,7 +6308,7 @@ \pnum \complexity -Exactly \tcode{last - first - 1} applications +At most \tcode{last - first - 1} applications of the corresponding predicate and no more than twice as many applications of any projection. \end{itemdescr} @@ -6351,7 +6351,7 @@ \pnum \complexity -Exactly \tcode{(last - first)/2} swaps. +At most \tcode{(last - first)/2} swaps. \end{itemdescr} \indexlibraryglobal{reverse_copy}% @@ -6403,7 +6403,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \rSec2[alg.rotate]{Rotate} @@ -6517,7 +6517,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \begin{itemdecl} @@ -6664,7 +6664,7 @@ \pnum \complexity -Exactly \tcode{(last - first) - 1} swaps. +At most \tcode{(last - first) - 1} swaps. \pnum \remarks @@ -7743,7 +7743,7 @@ \begin{itemize} \item For the overload with no \tcode{ExecutionPolicy}, - exactly $N$ applications of the predicate and projection. + at most $N$ applications of the predicate and projection. At most $N / 2$ swaps if the type of \tcode{first} meets the \oldconcept{BidirectionalIterator} requirements for the overloads in namespace \tcode{std} or @@ -7819,7 +7819,7 @@ \item For the overloads with no \tcode{ExecutionPolicy}, at most $N \log_2 N$ swaps, but only \bigoh{N} swaps if there is enough extra memory. - Exactly $N$ applications of the predicate and projection. + At most $N$ applications of the predicate and projection. \item For the overload with an \tcode{ExecutionPolicy}, \bigoh{N \log N} swaps and \bigoh{N} applications of the predicate. @@ -7896,7 +7896,7 @@ \pnum \complexity -Exactly \tcode{last - first} applications of \tcode{pred} and \tcode{proj}. +At most \tcode{last - first} applications of \tcode{pred} and \tcode{proj}. \end{itemdescr} \indexlibraryglobal{partition_point}% @@ -8982,7 +8982,7 @@ \pnum \complexity -Exactly one comparison and two applications of the projection, if any. +At most one comparison and two applications of the projection, if any. \pnum \remarks @@ -9025,7 +9025,7 @@ \pnum \complexity -Exactly \tcode{ranges::distance(r) - 1} comparisons +At most \tcode{ranges::distance(r) - 1} comparisons and twice as many applications of the projection, if any. \pnum @@ -9060,7 +9060,7 @@ \pnum \complexity -Exactly one comparison and two applications of the projection, if any. +At most one comparison and two applications of the projection, if any. \pnum \remarks @@ -9103,7 +9103,7 @@ \pnum \complexity -Exactly \tcode{ranges::distance(r) - 1} comparisons +At most \tcode{ranges::distance(r) - 1} comparisons and twice as many applications of the projection, if any. \pnum @@ -9140,7 +9140,7 @@ \pnum \complexity -Exactly one comparison and two applications of the projection, if any. +At most one comparison and two applications of the projection, if any. \pnum \remarks @@ -9240,7 +9240,7 @@ \pnum \complexity -Exactly $\max(\tcode{last - first - 1}, 0)$ comparisons and +At most $\max(\tcode{last - first - 1}, 0)$ comparisons and twice as many projections. \end{itemdescr} @@ -9287,7 +9287,7 @@ \pnum \complexity -Exactly $\max(\tcode{last - first - 1}, 0)$ comparisons and +At most $\max(\tcode{last - first - 1}, 0)$ comparisons and twice as many projections. \end{itemdescr} @@ -10319,7 +10319,7 @@ \pnum \complexity -Exactly \tcode{(last - first) - 1} applications of the binary operation. +At most \tcode{(last - first) - 1} applications of the binary operation. \pnum \remarks @@ -10831,7 +10831,7 @@ \pnum \complexity -Exactly \tcode{(last - first) - 1} applications of the binary operation. +At most \tcode{(last - first) - 1} applications of the binary operation. \pnum \remarks @@ -10866,7 +10866,7 @@ \pnum \complexity -Exactly \tcode{last - first} increments and assignments. +At most \tcode{last - first} increments and assignments. \end{itemdescr} \indexlibraryglobal{iota}% diff --git a/source/numerics.tex b/source/numerics.tex index 983a2d1bb6..39d98234f0 100644 --- a/source/numerics.tex +++ b/source/numerics.tex @@ -3121,7 +3121,7 @@ \pnum \complexity -Exactly $n \cdot \tcode{r}$ invocations +At most $n \cdot \tcode{r}$ invocations of \tcode{e}. \end{itemdescr} @@ -4446,7 +4446,7 @@ \pnum \complexity -Exactly $k$ invocations of \tcode{g} per attempt. +At most $k$ invocations of \tcode{g} per attempt. \pnum \begin{note}