From 34dac39df925edd138c9e097062dddfd832d16dd 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 | 80 +++++++++++++++++++++---------------------- source/numerics.tex | 4 +-- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/source/algorithms.tex b/source/algorithms.tex index a30ec42457..54250d019b 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -4638,7 +4638,7 @@ \pnum \complexity -Applies \tcode{f} exactly \tcode{last - first} times. +Applies \tcode{f} at most \tcode{last - first} times. \pnum \remarks @@ -4669,7 +4669,7 @@ \pnum \complexity -Applies \tcode{f} exactly \tcode{last - first} times. +Applies \tcode{f} at most \tcode{last - first} times. \pnum \remarks @@ -4714,7 +4714,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 @@ -5362,7 +5362,7 @@ \pnum \complexity For the non-parallel algorithm overloads, -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 parallel algorithm overloads, @@ -5457,7 +5457,7 @@ \pnum \complexity -Exactly \tcode{last - first} applications +At most \tcode{last - first} applications of the corresponding predicate and any projection. \end{itemdescr} @@ -5749,7 +5749,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}. @@ -5799,7 +5799,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}; @@ -6384,7 +6384,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \indexlibraryglobal{copy}% @@ -6436,7 +6436,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \indexlibraryglobal{copy_n}% @@ -6495,7 +6495,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \indexlibraryglobal{copy_if}% @@ -6660,7 +6660,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \rSec2[alg.move]{Move} @@ -6718,7 +6718,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \indexlibrary{\idxcode{move}!algorithm}% @@ -6783,7 +6783,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \indexlibraryglobal{move_backward}% @@ -6845,7 +6845,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \rSec2[alg.swap]{Swap} @@ -6926,7 +6926,7 @@ \pnum \complexity -Exactly $M$ swaps. +At most $M$ swaps. \end{itemdescr} \indexlibraryglobal{iter_swap}% @@ -7113,7 +7113,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 parallel algorithm overloads. @@ -7225,7 +7225,7 @@ \pnum \complexity -Exactly \tcode{last - first} applications +At most \tcode{last - first} applications of the corresponding predicate and any projection. \end{itemdescr} @@ -7383,7 +7383,7 @@ \pnum \complexity -Exactly $N$ applications +At most $N$ applications of the corresponding predicate and any projection. \end{itemdescr} @@ -7451,7 +7451,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \rSec2[alg.generate]{Generate} @@ -7516,7 +7516,7 @@ \pnum \complexity -Exactly $N$ evaluations of \tcode{gen()} and assignments. +At most $N$ evaluations of \tcode{gen()} and assignments. \pnum \remarks @@ -7621,7 +7621,7 @@ \pnum \complexity -Exactly \tcode{last - first} applications +At most \tcode{last - first} applications of the corresponding predicate and any projection. \pnum @@ -7872,7 +7872,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} @@ -8080,7 +8080,7 @@ \pnum \complexity -Exactly \tcode{(last - first)/2} swaps. +At most \tcode{(last - first)/2} swaps. \end{itemdescr} \indexlibraryglobal{reverse_copy}% @@ -8132,7 +8132,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \begin{itemdecl} @@ -8172,7 +8172,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \rSec2[alg.rotate]{Rotate} @@ -8304,7 +8304,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \begin{itemdecl} @@ -8348,7 +8348,7 @@ \pnum \complexity -Exactly $N$ assignments. +At most $N$ assignments. \end{itemdescr} \begin{itemdecl} @@ -8512,7 +8512,7 @@ \pnum \complexity -Exactly \tcode{(last - first) - 1} swaps. +At most \tcode{(last - first) - 1} swaps. \pnum \remarks @@ -9736,7 +9736,7 @@ \begin{itemize} \item For the non-parallel algorithm overloads, - 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 @@ -9824,7 +9824,7 @@ For the non-parallel algorithm overloads, 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 parallel algorithm overloads, \bigoh{N \log N} swaps and \bigoh{N} applications of the predicate. @@ -11296,7 +11296,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 @@ -11344,7 +11344,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 @@ -11379,7 +11379,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 @@ -11427,7 +11427,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 @@ -11464,7 +11464,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 @@ -11579,7 +11579,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} @@ -11636,7 +11636,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} @@ -12692,7 +12692,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 @@ -13204,7 +13204,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 @@ -13239,7 +13239,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 8fc213a725..134b62cded 100644 --- a/source/numerics.tex +++ b/source/numerics.tex @@ -3122,7 +3122,7 @@ \pnum \complexity -Exactly $n \cdot \tcode{r}$ invocations +At most $n \cdot \tcode{r}$ invocations of \tcode{e}. \end{itemdescr} @@ -4447,7 +4447,7 @@ \pnum \complexity -Exactly $k$ invocations of \tcode{g} per attempt. +At most $k$ invocations of \tcode{g} per attempt. \pnum \begin{note}