Skip to content

Commit c72882f

Browse files
committed
Merge pull request #590 from tkoeppe/algorithm
[algorithms] Improve typographic consistency of complexity expressions
2 parents 006f586 + f09023e commit c72882f

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

source/algorithms.tex

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,9 +2271,8 @@
22712271

22722272
\pnum
22732273
\complexity
2274-
At most
2275-
\tcode{(last - first) * log(last - first)}
2276-
swaps, but only linear number of swaps if there is enough extra memory.
2274+
At most $N \log(N)$ swaps, where $N = \tcode{last - first}$,
2275+
but only \bigoh{N} swaps if there is enough extra memory.
22772276
Exactly
22782277
\tcode{last - first}
22792278
applications of the predicate.
@@ -2324,7 +2323,7 @@
23242323
\returns An iterator \tcode{mid} such that \tcode{all_of(first, mid, pred)} and \tcode{none_of(mid, last, pred)} are both true.
23252324

23262325
\pnum
2327-
\complexity \bigoh{log(last - first)} applications of \tcode{pred}.
2326+
\complexity \bigoh{\log(\tcode{last - first})} applications of \tcode{pred}.
23282327
\end{itemdescr}
23292328

23302329

@@ -2481,10 +2480,7 @@
24812480

24822481
\pnum
24832482
\complexity
2484-
\bigoh{N\log(N)}
2485-
(where
2486-
\tcode{$N$ == last - first})
2487-
comparisons.
2483+
\bigoh{N\log(N)} comparisons, where $N = \tcode{last - first}$.
24882484
\end{itemdescr}
24892485

24902486
\rSec3[stable.sort]{\tcode{stable_sort}}
@@ -2515,11 +2511,9 @@
25152511

25162512
\pnum
25172513
\complexity
2518-
It does at most $N \log^2(N)$
2519-
(where
2520-
\tcode{$N$ == last - first})
2521-
comparisons; if enough extra memory is available, it is
2522-
$N \log(N)$.
2514+
At most $N \log^2(N)$
2515+
comparisons, where
2516+
$N = \tcode{last - first}$, but only $N \log(N)$ comparisons if there is enough extra memory.
25232517

25242518
\pnum
25252519
\remarks Stable~(\ref{algorithm.stable}).
@@ -3045,12 +3039,7 @@
30453039
\tcode{(last - first) - 1}
30463040
comparisons.
30473041
If no additional memory is available, an algorithm with complexity
3048-
$N \log(N)$
3049-
(where
3050-
\tcode{N}
3051-
is equal to
3052-
\tcode{last - first})
3053-
may be used.
3042+
$N \log(N)$ may be used, where $N = \tcode{last - first}$.
30543043

30553044
\pnum
30563045
\remarks Stable~(\ref{algorithm.stable}).
@@ -3381,7 +3370,7 @@
33813370
\pnum
33823371
\complexity
33833372
At most
3384-
\tcode{log(last - first)}
3373+
$\log(\tcode{last - first})$
33853374
comparisons.
33863375
\end{itemdescr}
33873376

@@ -3422,7 +3411,7 @@
34223411
\pnum
34233412
\complexity
34243413
At most
3425-
\tcode{2 * log(last - first)}
3414+
$2 \log(\tcode{last - first})$
34263415
comparisons.
34273416
\end{itemdescr}
34283417

@@ -3488,8 +3477,8 @@
34883477
\pnum
34893478
\complexity
34903479
At most $N \log(N)$
3491-
comparisons (where
3492-
\tcode{N == last - first}).
3480+
comparisons, where
3481+
$N = \tcode{last - first}$.
34933482
\end{itemdescr}
34943483

34953484
\rSec3[is.heap]{\tcode{is_heap}}

0 commit comments

Comments
 (0)