Exercise Lover

April 2, 2007

Problems 3-6

Filed under: Problem 3 — yuhanlyu @ 6:17 am
  f(n) c f^*_c(n)
a n-1 0 n
b lg n 1 lg* n
c n/2 1 lg n
d n/2 2 lg n – 1
e \sqrt{n} 2 lg lg n
f \sqrt{n} 1
g n^{1/3} 2 \lg_3 \lg n
g n/lg n 2 lg* n

Problems 3-5

Filed under: Problem 3 — yuhanlyu @ 6:11 am

Solution Wanted!

Problems 3-4

Filed under: Problem 3 — yuhanlyu @ 6:11 am

a. No, 1 = O(n), but n is not O(1).

b. No, 1 + n ≠ Θ(min(1,n)) = Θ(1).

c. Yes, f(n) ≤ cg(n), so lg f(n) = lg( g(n) ) + lg c.

d. No, 2n = O(n), but 2^{2n}2^n.

e. Only true for f(n) > 1

f. Yes, f(n)≤cg(n), so g(n) ≥ f(n)/c.

g. No, 2^n\Theta(2^{n/2}).

h. Yes

Problems 3-3

Filed under: Problem 3 — yuhanlyu @ 5:59 am

a.

Exponential: 2^{2^{n+1}} > 2^{2^n} > (n+1)! > n! > e^n > n2^n > 2^n > (3/2)^n.

Moderated Exponential: (\lg n)^{\lg n} > (\lg n)!.

Polynomial: n^3 > n^2 = 4^{\lg n} > n lg n = lg n! > n = 2^{\lg n} > \sqrt{2}^{\lg n}

Polylogarithmic: 2^{\sqrt{2 \lg n}} > \lg^2 n > ln n > \sqrt{\lg n} > ln ln n.

Very slow: 2^{lg^* n} > lg *n = lg*(lg n) > lg (lg *n) > n^{1/\lg n} = 1.

b.

f(n) = 0, if n is odd. f(n) = 2^{2^{n+2}}, if n is even.

April 1, 2007

Problems 3-2

Filed under: Problem 3 — yuhanlyu @ 1:38 pm
  A B O o ω Θ
a. \lg^k n n^{\epsilon} Yes Yes No No No
b. n^k c^n Yes Yes No No No
c. \sqrt{n} n^{\sin n} No No No No No
d. 2^n 2^{n/2} No No Yes Yes No
e. n^{\lg c} c^{\lg n} Yes No Yes No Yes
f. lg(n!) \lg (n^n) Yes Yes Yes No Yes

Problems 3-1

Filed under: Problem 3 — yuhanlyu @ 1:28 pm

a. If k ≥ d, then we choose c as a_d + 1, then there must exist some n_0, such that p(n) ≤ cn^k for all n ≥ n_0.

b.  If k ≤ d, then we choose c as a_d - 1, then there must exist some n_0, such that p(n) ≥ cn^k for all n ≥ n_0.

c. If k = d, then a and b’s condition holds. Hence p(n) = \Theta(n^k).

d. If k > d, then p(n)/n^k = 0, when n → ∞. Hence p(n) = o(n^k).

e. If k < d, then p(n)/n^k = ∞, when n → ∞. Hence p(n) = \omega(n^k).

Exercises 3.2-7

Filed under: 3.2 — yuhanlyu @ 6:16 am

Proof by induction.
Base case: F_2 = 1 = \phi^0.
Induction case: Assume that F_{i+2}\phi^i for all i < k. Then F_{k+2} = F_k + F_{k+1}\phi^{k-1} + \phi^{k-1}\phi^k. Because φ is the root of x^2 - x - 1= 0.

Exercises 3.2-6

Filed under: 3.2 — yuhanlyu @ 6:09 am

Exercises 3.2-5

Filed under: 3.2 — yuhanlyu @ 6:00 am

lg *(lg n) = (lg* n) – 1 > lg (lg* n).

Exercises 3.2-4

Filed under: 3.2 — yuhanlyu @ 5:56 am

No, it is moderated exponential, which larger than any polynomial but smaller than any exponential.
Take logarithm on any polynomial will get a constant, but \lg (\lceil \lg n \rceil)! = \Theta(\lceil \lg n \rceil \lg (\lceil \lg n \rceil)). It is not constant.
But \lg (\lceil \lg \lg n \rceil)! = Θ(lg lg n lg lg lg n) = o( (lg lg n)^2 ) = o( lg n ). So it is polynomial bounded.

Older Posts »

Blog at WordPress.com.