From 44b21acb0c4e5a73fa0af7ad87a427528bd827a1 Mon Sep 17 00:00:00 2001 From: Cassio Neri Date: Sat, 15 Feb 2014 02:04:30 +0000 Subject: [PATCH] Reformated several "Complexity" clauses. --- source/algorithms.tex | 16 ++++++++-------- source/containers.tex | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/source/algorithms.tex b/source/algorithms.tex index 706a044416..7e1e065c7a 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -3443,7 +3443,7 @@ \pnum \complexity At most -\tcode{3 * (last - first)} +$3(\tcode{last - first})$ comparisons. \end{itemdescr} @@ -3683,7 +3683,7 @@ equivalent to the largest. \pnum -\complexity At most \tcode{(3/2) * t.size()} applications of the corresponding predicate. +\complexity At most $(3/2)\tcode{t.size()}$ applications of the corresponding predicate. \end{itemdescr} \indexlibrary{\idxcode{min_element}}% @@ -3719,7 +3719,7 @@ \pnum \complexity Exactly -\tcode{max((last - first) - 1, 0)} +$\max(\tcode{last - first} - 1, 0)$ applications of the corresponding comparisons. \end{itemdescr} @@ -3755,7 +3755,7 @@ \pnum \complexity Exactly -\tcode{max((last - first) - 1, 0)} +$\max(\tcode{last - first} - 1, 0)$ applications of the corresponding comparisons. \end{itemdescr} @@ -3782,7 +3782,7 @@ \pnum \complexity At most -$max(\lfloor{\frac{3}{2}} (N-1)\rfloor, 0)$ +$\max(\lfloor{\frac{3}{2}} (N-1)\rfloor, 0)$ applications of the corresponding predicate, where $N$ is \tcode{last - first}. \end{itemdescr} @@ -3816,7 +3816,7 @@ \pnum \complexity At most -\tcode{2*min((last1 - first1), (last2 - first2))} +$2\min(\tcode{last1 - first1}, \tcode{last2 - first2})$ applications of the corresponding comparison. \pnum @@ -3882,7 +3882,7 @@ \pnum \complexity At most -\tcode{(last - first)/2} +$(\tcode{last - first})/2$ swaps. \end{itemdescr} @@ -3925,7 +3925,7 @@ \pnum \complexity At most -\tcode{(last - first)/2} +$(\tcode{last - first})/2$ swaps. \end{itemdescr} diff --git a/source/containers.tex b/source/containers.tex index e8759abccc..1c0728178d 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -1391,7 +1391,7 @@ and \tcode{CopyAssignable}.\br \effects Assigns the range \range{il.begin()}{il.end()} into \tcode{a}. All existing elements of \tcode{a} are either assigned to or destroyed. & - $N log N$ in general (where $N$ has the value \tcode{il.size() + a.size()}); + $N \log N$ in general (where $N$ has the value \tcode{il.size() + a.size()}); linear if \range{il.begin()}{il.end()} is sorted with \tcode{value_comp()}. \\ \rowsep @@ -1485,7 +1485,7 @@ inserts each element from the range \range{i}{j} if and only if there is no element with key equivalent to the key of that element in containers with unique keys; always inserts that element in containers with equivalent keys. & - $N\log (\mathrm{a.size}() + N)$ ($N$ has the value \tcode{distance(i, j)} \\ \rowsep + $N\log (\tcode{a.size()} + N)$ ($N$ has the value \tcode{distance(i, j)}) \\ \rowsep \tcode{a.insert(il)} & \tcode{void} & @@ -1496,7 +1496,7 @@ \tcode{size_type} & erases all elements in the container with key equivalent to \tcode{k}. returns the number of erased elements. & - $\log (\mathrm{a.size}()) + \mathrm{a.count}(k)$ \\ \rowsep + $\log (\tcode{a.size()}) + \tcode{a.count(k)}$ \\ \rowsep \tcode{a.erase(q)} & \tcode{iterator} & @@ -1518,7 +1518,7 @@ erases all the elements in the range \range{q1}{q2}. Returns an iterator pointing to the element pointed to by q2 prior to any elements being erased. If no such element exists, \tcode{a.end()} is returned. & - $\log (\mathrm{a.size}()) + N$ where $N$ has the value \tcode{distance(q1, q2)}. \\ \rowsep + $\log (\tcode{a.size()}) + N$ where $N$ has the value \tcode{distance(q1, q2)}. \\ \rowsep \tcode{a.clear()} & \tcode{void} & @@ -1543,14 +1543,14 @@ \tcode{a.count(k)} & \tcode{size_type} & returns the number of elements with key equivalent to \tcode{k} & - $\log (\mathrm{a.size}()) + \mathrm{a.count}(k)$ \\ \rowsep + $\log (\tcode{a.size()}) + \tcode{a.count(k)}$ \\ \rowsep \tcode{a_tran.}\br \tcode{count(ke)} & \tcode{size_type} & returns the number of elements with key \tcode{r} such that \tcode{!c(r, ke) \&\& !c(ke, r)} & - $\log (\mathrm{a\_tran.size}()) + \mathrm{a\_tran.count}(\mathrm{ke})$ \\ \rowsep + $\log (\tcode{a_tran.size()}) + \tcode{a_tran.count(ke)}$ \\ \rowsep \tcode{a.lower_bound(k)} & \tcode{iterator}; \tcode{const_iterator} for constant \tcode{a}. & @@ -1889,7 +1889,7 @@ \effects\ Constructs an empty container with at least \tcode{n} buckets, using \tcode{hf} as the hash function and \tcode{eq} as the key equality predicate. -& \bigoh{n} +& \bigoh{\tcode{n}} \\ \rowsep % \tcode{X(n, hf)}\br \tcode{X a(n, hf)} @@ -1899,7 +1899,7 @@ \effects\ Constructs an empty container with at least \tcode{n} buckets, using \tcode{hf} as the hash function and \tcode{key_equal()} as the key equality predicate. -& \bigoh{n} +& \bigoh{\tcode{n}} \\ \rowsep % \tcode{X(n)}\br \tcode{X a(n)} @@ -1908,7 +1908,7 @@ \effects\ Constructs an empty container with at least \tcode{n} buckets, using \tcode{hasher()} as the hash function and \tcode{key_equal()} as the key equality predicate. -& \bigoh{n} +& \bigoh{\tcode{n}} \\ \rowsep % \tcode{X()}\br \tcode{X a} @@ -2116,7 +2116,7 @@ \indextext{unordered associative containers!\idxcode{insert}}% \indextext{\idxcode{insert}!unordered associative containers}% & Average case \bigoh{N}, where $N$ is \tcode{distance(i, j)}. Worst - case \bigoh{N * \tcode{(a.size())}\br\tcode{+ N}}. + case $\bigoh{N(\tcode{a.size()} + 1)}$. \\ \rowsep % \tcode{a.insert(il)} @@ -3758,7 +3758,7 @@ \throws Nothing. \pnum -\complexity \bigoh{distance(x.begin(), x.end())} +\complexity \bigoh{\tcode{distance(x.begin(), x.end())}} \end{itemdescr} \indexlibrary{\idxcode{splice_after}!\idxcode{forward_list}}% @@ -3815,7 +3815,7 @@ behave as iterators into \tcode{*this}, not into \tcode{x}. \pnum -\complexity \bigoh{distance(first, last)} +\complexity \bigoh{\tcode{distance(first, last)}} \end{itemdescr} \indexlibrary{\idxcode{remove}!\idxcode{forward_list}}%