Solution to Exercise 3.1-2
To show that (n+a)b = Θ(nb), we want to find constants c1, c2, n0 > 0 such that
0 ≤ c1nb ≤ (n+a)b ≤ c2nb for all n ≥ n0
Note that
n + a ≤ n + |a| ≤ 2n when |a|≤n,
and
n + a ≥ n - |a| ≥ 1/2n when |a|≤1/2n,
Thus, when n ≥ 2|a|
0 ≤ 1/2n ≤ n + a ≤ 2n,
Since b > 0, the inequality still holds when all parts are raised to the power b:
0 ≤ (1/2n)b ≤ (n+a)b ≤ (2n)b,
0 ≤ (1/2)bnb ≤ (n+a)b ≤ 2bnb,
Thus, c1 = (1/2)b, c2 = 2b, and n0 = 2|a| satisfy the definition.
Solution to Exercise 3.1-3
Let the running time be T(n). T(n) ≥ Ο(n2) means that T(n) ≥ f(n) for some function f(n) in the set Ο(n2). This statement holds for any running time T(n), since the function g(n) = 0 for all n is in Ο(n2), and running times are always nonnegative. Thus, the statement tells us nothing about the running time.
Solution to Exercise 3.1-4
2n+1 = Ο(2n), but 22n ≠ Ο(2n)
To show that 2n+1 = Ο(2n), we must find constant c, n0 > 0 such that
0 ≤ 2n+1 ≤ c · 2n for all n > n0 ,
Since 2n+1 = 2 · 2n for all n, we can satisfy the definition with c = 2 and n0 = 1
To show that 22n ≠ Ο(2n), assume there exist constants c, n0 > 0 such that
0 ≤ 22n ≤ c · 2n for all n > n0 ,
The 22n = 2n · 2n ≤ c · 2n for all n ≥ n0 ,
Then 22n = 2n · 2n ≤ c · 2n => 2n ≤ c. But no constant is greater than 2n, and so the assumption leads to a contradiction.
*Solution to Exercise 3.2-4
⌈lgn⌉! is not polynomially bounded, but ⌈lglgn!⌉ is.
Proving that a function f(n) is polynomially bounded is equivalent to proving that lg(f(n)) = Ο(lgn) for the following reasons.
· if f is polynomially bounded, then there exits constant c, k, n0 such that
for all n ≥ n0, f(n) ≤ cnk. Hence, lg(f(n)) ≤ kclgn, which, since c and k are constants, means that lg(f(n)) = Ο(lgn).
· Similarly, if lg(f(n)) = Ο(lgn), then f is polynomially bounded.
In the following proofs, we will make use of the following two facts:
1. lg(n!) = Θ(nlgn) (by equation (3.19))
2. ⌈lgn⌉ = Θ(lgn), because
· ⌈lgn⌉ ≥ lgn
· ⌈lgn⌉ ≤ lgn + 1 ≤ 2lgn for all n ≥ 2
lg(⌈lgn⌉!) = Θ(⌈lgn⌉lg⌈lgn⌉) = Θ(lgn lg lgn) = ω(lgn).
Therefore, lg(⌈lgn⌉!) ≠ Ο(lgn), and so ⌈lgn⌉! is not polynomially bounded.
lg(⌈lglgn⌉!) = Θ(⌈lglgn⌉lg⌈lglgn⌉) = Θ(lglgn lg lglgn) = ο((lglgn)2) = ο(lg2(lgn)) = ο(lgn) .
The last step above follows from the property that any polylogarithmic function grows more slowly than any positive polynomial function, i.e., that for constants a, b > 0, we have lgbn = ο(na). Substitute lgn for n, 2 for b, and 1 for a, giving lg2(lgn) = ο(lgn).
Therefore, lg(⌈lglgn⌉!) = Ο(lgn), and so ⌈lglgn⌉! is polynomially bounded.