diff --git a/02-splay/splay.tex b/02-splay/splay.tex index 0f22ae6ad22d0b77d576d8b99609165bfb75d984..d7018ac3f30dfb7089b1a3690b82b71941a4c1eb 100644 --- a/02-splay/splay.tex +++ b/02-splay/splay.tex @@ -89,7 +89,7 @@ and once negatively. Therefore the right-hand side is equal to $3r_t(x) - 3r_0(x as claimed by the theorem. \qed -\corr{ +\cor{ As all ranks are logarithmic, the amortized cost of \alg{Splay} is $\O(\log n)$. } @@ -143,7 +143,7 @@ $ \sqrt{\alpha\beta} \le (\alpha + \beta) / 2 $. As $\log{\alpha+\beta\over 2} = \log(\alpha+\beta) - 1$, the lemma implies: -\corrxn{S}{sum of logarithms}{ +\corxn{S}{sum of logarithms}{ For positive $\alpha$, $\beta$: $\log \alpha + \log \beta \le 2\log(\alpha+\beta) - 2$. } diff --git a/03-abtree/abtree.tex b/03-abtree/abtree.tex index 94642e3bd8527466f356fd7dce3746dea24e6d03..5b649db0d7a3944798ff9471089736cdf5915249 100644 --- a/03-abtree/abtree.tex +++ b/03-abtree/abtree.tex @@ -100,7 +100,7 @@ $$ Therefore in each tree, we have $n \le b^h-1$, so $h \ge \log_b (n+1)$. \qed -\corr{The height is $\Omega(\log_b n)$ and $\O(\log_a n)$.} +\cor{The height is $\Omega(\log_b n)$ and $\O(\log_a n)$.} \subsection{Searching for a~key} diff --git a/04-heaps/heaps.tex b/04-heaps/heaps.tex index f178168cc15f6baff77067c7020c659753affe7a..d09159ff1d7ee9bfbf4e7619892a338c5de05de5 100644 --- a/04-heaps/heaps.tex +++ b/04-heaps/heaps.tex @@ -144,7 +144,7 @@ present in the heap. Since each~$n$ has a~unique binary representation, the shape of the heap is fully determined by its size. Still, we have a~lot of freedom in location of items in the heap. -\corr{ +\cor{ A~binomial heap with $n$~items contains $\O(\log n)$ trees, whose ranks and heights are $\O(\log n)$. Each node has $\O(\log n)$ children. } @@ -500,7 +500,7 @@ can be written as $F_0 + F_1 + F_2 + \ldots + F_k + 1$. By the previous lemma, t is equal to~$F_{k+2}$. This completes the induction step. \qed -\corrx{R}{ +\corx{R}{ The ranks of all nodes are $\O(\log n)$. } diff --git a/05-cache/cache.tex b/05-cache/cache.tex index a531894555340c3823559b37981338499e5dec33..7a6ac56be8f106ad743595cdcba446ab47af6693 100644 --- a/05-cache/cache.tex +++ b/05-cache/cache.tex @@ -416,7 +416,7 @@ the same. When OPT starts with non-empty cache, it can save up to $\Copt$ misses which is compensated by the extra $\Copt$ term in the statement of the theorem. \qed -\corr{ +\cor{ If we set $\Clru = 2\cdot\Copt$, then $\Tlru \le 2\Topt + \Copt$. So on a~long enough access sequence, LRU is $(2+\varepsilon)$-competitive. } diff --git a/06-hash/hash.tex b/06-hash/hash.tex index ac786df6aa4ffc4e1e80646d46aa2360a3fdbc4e..a038b92e1d075257787fa72bbf504ef5da26e120 100644 --- a/06-hash/hash.tex +++ b/06-hash/hash.tex @@ -78,7 +78,7 @@ By linearity of expectation, we have $\E[A] = \E[\sum_i A_i] = \sum_i \E[A_i] \le \sum_i c/m = cn/m$. \qed -\corrn{Complexity of hashing with chaining}{ +\corn{Complexity of hashing with chaining}{ Consider a~hash table with chaining which uses $m$~buckets and a~hash function~$h$ picked at random from a~$c$-universal family. Suppose that the hash table contains items $x_1,\ldots,x_n$. @@ -338,7 +338,7 @@ So $\Pr[M] \le d/m^2 + cd/mr$. We want to write this as $c' / m^2$, so $c' = d + cdm/r = (1 + cm/r)d$. \qed -\corr{ +\cor{ The family ${\cal F}\circ {\cal G}$ is also $(2,c')$-independent for $c' = (c+1)d$. } @@ -369,7 +369,7 @@ Of course hashing from a~field to the same field is of little use, so we usually consider the family ${\cal P}_k\bmod m$ instead. If we set~$p$ large enough, Lemma~\xx{K} guarantees: -\corr{If $p \ge 2km$, the family ${\cal P}_k\bmod m$ is $(k,2)$-independent.} +\cor{If $p \ge 2km$, the family ${\cal P}_k\bmod m$ is $(k,2)$-independent.} The downside is that we need time $\Theta(k)$ both to pick a~function from the family and to evaluate it for a~single~$x$. @@ -549,7 +549,7 @@ linear functions. Not only we get a~2-independent family as a~result, but Lemma~ guarantees that if $p$~is sufficiently large, the big constant from $d$-universality disappears. -\corr{Given a~prime~$p$ and the number of buckets~$m$ such that $p \ge 4km$, the +\cor{Given a~prime~$p$ and the number of buckets~$m$ such that $p \ge 4km$, the compound family ${\cal R}\circ {\cal L}$ is $(2,5)$-independent.} Hash functions of this kind play important role in the \em{Rabin-Karp string search @@ -788,7 +788,7 @@ is bounded by the probability that one of the 12 blocks is critical. By union bound and our estimate on the probability that a~block is critical, we get: -\corr{ +\cor{ Let~$R$ be a~run containing $h(x)$. The probability that $\vert R\vert \in [2^{\ell+2}, 2^{\ell+3})$ is at most $12 \cdot (\e/4)^{2^\ell / 3}$ = $12\cdot q^{2^\ell}$, where $q = (\e/4)^{1/3} \doteq 0.879$. diff --git a/07-geom/geom.tex b/07-geom/geom.tex index f7591a64975478f6fddd6152050e696d455ab3c9..ce18c28aa4bcc8caa13f7461b258a7a97d019fc3 100644 --- a/07-geom/geom.tex +++ b/07-geom/geom.tex @@ -119,7 +119,7 @@ Since all paths contain $\O(\log n)$ nodes together, we visit $\O(\log n)$ nodes and report $\O(\log n)$ nodes and $\O(\log n)$ subtrees. \qed -\corr{ +\cor{ An~enumeration query is answered in time $\O(\log n + p)$, where~$p$ is the number of items reported. If we precompute sizes of all subtrees, a~counting query takes $\O(\log n)$ time. Aggregate queries can be answered if we precompute aggregate diff --git a/08-string/string.tex b/08-string/string.tex index a2ccb5e10d6a2717d27d4054864290515ee70863..e80bc45977636fa4c86c7e74a426d9c9f2f51f24 100644 --- a/08-string/string.tex +++ b/08-string/string.tex @@ -72,7 +72,7 @@ We can easily find the start and end of this range using binary search on the su We need $\O(\log |\alpha|)$ steps, each step involves string comparison with~$\alpha$, which takes $\O(|\beta|)$ time in the worst case. This makes $\O(|\beta| \log|\alpha|)$ total. -\corr{Using the suffix array for~$\alpha$, we can enumerate all occurrences of a~substring~$\beta$ +\cor{Using the suffix array for~$\alpha$, we can enumerate all occurrences of a~substring~$\beta$ in time $\O(|\beta| \log |\alpha| + p)$, where $p$~is the number of occurrences reported. Only counting the occurrences costs $\O(|\beta| \log |\alpha|)$ time. } diff --git a/tex/adsmac.tex b/tex/adsmac.tex index c9cc073cb5990f3a361f0467be87a44053b78651..87791829c346d78dc94323d9197a902428c7a2d0 100644 --- a/tex/adsmac.tex +++ b/tex/adsmac.tex @@ -755,10 +755,10 @@ \def\obs{\s{Observation:} \sbody} \def\note{\s{Note:} \sbody} \def\noten#1{\s{Note (#1):} \sbody} -\def\corr{\s{Corrolary:} \sbody} -\def\corrn#1{\s{Corrolary (#1):} \sbody} -\def\corrx#1{\s{Corrolary #1:} \sbody} -\def\corrxn#1#2{\s{Corrolary~#1 (#2):} \sbody} +\def\cor{\s{Corollary:} \sbody} +\def\corn#1{\s{Corollary (#1):} \sbody} +\def\corx#1{\s{Corollary #1:} \sbody} +\def\corxn#1#2{\s{Corollary~#1 (#2):} \sbody} \def\nota{\s{Notation:} \sbody} \def\example{\s{Example:} \sbody} \def\examples{\s{Examples:} \sbody}