Chapter 3 Exercises and Problems

Exercises
3.1-4 Is 2^(n+1) = O(2^n)? Is 2^2n = O(2^n)?
Yes. No.

3.1-7 Prove that o(g(n)) ∩ ω(g(n)) is the empty set.
Assuming that there is a function f(n) ∈o(g(n)) ∩ ω(g(n))
then f(n) ∈o(g(n)) ,f(n) ∈ω(g(n))
For f(n) ∈o(g(n)), it can be concluded that for all constant c>0, there exists x>0 such that 0 < f(n) <= c*g(n) for all n>=x
For f(n) ∈ω(g(n)), it can be concluded that for all constant c>0, there exists y>0 such that 0 <= c*g(n) < f(n) for all n>=y
Thus for all n>=max(x,y) and any constant c>0, the inequality 0 < f(n) <= c*g(n) < f(n) satisfies, which leads to a f(n) < f(n) conclusion.
Thus no f(n) exists, and o(g(n)) ∩ ω(g(n)) is the empty set.

3.2-4 Is the function ceil(lgn)! polynomially bounded? Is the function ceil(lglgn)! polynomially bounded?
No. Yes. The proofs are below.
1) For f(n) = ceil(lgn), we use a lemma to prove f(n) is not polynomially bounded.
Lemma 3.2-4,1 n! >= (n/e)^n
Note before the proof: it is all right if you use other lemmas such as n! >= 2^((n-2)lgn) or others. I use this lemma simply because the proof is relatively simpler.
Proof: n! >= (n/e)^n <==> ln(n!) >= n*ln(n)-n (3.1)
if we can prove ln(n+1) >= (n+1)ln(n+1) - nln(n) - 1, equation(3.1) is proved by simply adding ln(2)...ln(n) together.
ln(n+1) >= (n+1)ln(n+1) - nln(n) - 1
<==> 1 >= n*(ln(n+1) - ln(n))
<==> 1 >= ln( (1+1/n)^n )
<==> (1+1/n)^n <= e, which is absolutely correct
thus the lemma is proved
Therefore, assuming k = ceil(lgn) (thus k >= lgn),
f(n) = k! >= (k/e)^k >= (lg(n)/e)^lgn = lgn^lgn / e^lgn = n^lglgn / n^lg(e) = n^(lglgn-1)
Since n^(lglgn-1) is not polynomially bounded, f(n) is not polynomially bounded.
2) For f(n) = ceil(lglgn)! we're to prove f(n) = O(n)
Lemma 3.2-4,2 n! <= (n/e)^(n+1)
The proof is similar, which lead to an absolutely correct statement (1+1/n)^(n+1) >= e
Therefore, assuming k = ceil(lglgn) (thus k <= lglgn + 1),
f(n) = k! <= (k/e)^(k+1) <= ((lglgn + 1)/e)^(lglgn + 2)
<= (lglgn / 2) ^ (2 + lglgn)
<= lglgn ^ lglgn (assuming x=lglgn, ~<=> x^2 <= 2^(x+2))
So if lglgn ^ lglgn = O(n) is proved, then f(n) = O(n) is proved.
lglgn ^ lglgn = O(n)
<==> lglgn ^ lglgn <= cn, for some constant c
<== lg[3](n) * lg[2](n) <= lg(cn) for some constant c (3.2)
Meanwhile, we have: (note: the n mentioned below is sufficiently large)
lg[3](n) * lg[2](n) <= lg[2](n)^2 (log(n)<=n)
<= lg(sqrt(n)^2) (log(n) <= n^k for k>0)
= lg(n)
Therefore, lg[3](n)*lg[2](n) <= lg(n), lglgn ^ lglgn <= n, thus f(n) = O(n)

3.2-5 Which is asymptotically larger: lg(lg*(n)) or lg*(lg(n))?
lg*(lg(n)) = lg*(n) - 1
Therefore lg(lg*(n)) is asymptotically SMALLER than lg*(n)-1 = lg*(lg(n))

Problems
3-4 Asymptotic notation properties
Prove or disprove the following conjectures.
d. f(n) = O(g(n)) implies 2^f(n) = O(2^g(n))
Wrong. f(n) = 2n, g(n) = n
e. f(n) = O(f(n)^2)
Wrong. f(n) = 1/n (i.e. f(n) < 1. This statement is true only if f(n) > 1)
g. f(n) = Θ(f(n/2))
Wrong. f(n) = 2^n

3-6 Iterated functions
For each of the following functions f(n) and constants c, give as tight a bound as possible on f*(n)
h. f(n) = n/lgn, c = 2
I'm going to prove f*(n) = O(logn), f*(n) = Ω(logn/loglogn).
Proof: try to prove f*(n) <= f*(n/2) + 1
If n >= 4, then lgn >= 2
thus n/lgn <= n/2, f*(n) = f*(n/lgn) + 1 <= f*(n/2) + 1 (f* is a monotonically increasing function)
So it applies that f*(n) = O(logn) (since T(n) = T(n/2) + 1 makes T(n) = Θ(logn))
Proof of the Ω part is similar, trying to prove f*(k) >= f*(k/lgn)+1 (Here, n is the initial variable n, and k is variable for the recurrence, satisfying k<=n)
Then f*(n) = Ω(log(logn,n)) = Ω(logn/loglogn) can be proved.

转载于:https://www.cnblogs.com/FancyMouse/articles/1014275.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值