Exercise Lover

March 31, 2007

Exercises 3.1-8

Filed under: 3.1 — yuhanlyu @ 4:51 am

Ω(g(n,m)) = {f(n,m): there exists positive constant c, n_0, and m_0 such that 0 ≤cg(n,m) ≤ f(n, m)  for all n ≥ n_0 and m ≥ m_0.

Θ(g(n,m)) =  Ω(g(n,m))∩O(g(n,m))

Exercises 3.1-7

Filed under: 3.1 — yuhanlyu @ 4:47 am

If f(n)=o(g(n)), then f(n)/g(n)=0, when n→ ∞. If f(n) = ω(g(n)), then f(n)/g(n)=∞, when n→ ∞. So f(n) can’t equal to both o(g(n)) and ω(g(n)).

Exercises 3.1-6

Filed under: 3.1 — yuhanlyu @ 4:26 am

If the running time is Θ(g(n)), it means that the algorithm can run at most O(g(n)), And the algorithm run at least Ω(g(n)). Since worst case is the longest running time, and best case is the fastest running time. So worst case must be O(g(n)), and best case must be Ω(g(n)).

Exercises 3.1-5

Filed under: 3.1 — yuhanlyu @ 4:03 am

Because f(n)=O(g(n)), then there exists constants a and b, such that f(n) ≤ ag(n) for all n > b.
f(n) = Ω(g(n)), then there exists constants c and d, such that f(n) ≥ cg(n) for all n > d.
Then we can get, cg(n) ≤ f(n) ≤ ag(n) for all n > max(b, d).

The proof of other direction is also easy.

Exercises 3.1-4

Filed under: 3.1 — yuhanlyu @ 3:56 am

2^{n+1} = O(2^n), because 2^{n+1} \leq 42^n.

2^{2n} is not O(2^n), because \frac{2^{2n}}{2^n} = 2^n. That means 2^{2n} = \omega(2^n).

Exercises 3.1-3

Filed under: 3.1 — yuhanlyu @ 3:53 am

Since the running time is at least f(n) menas the lower bound. But big-O means the upper bound, so we still don’t know the actually lower bound.

Exercises 3.1-2

Filed under: 3.1 — yuhanlyu @ 3:49 am

(n+a)^b = \sum^b_{i=0} {b \choose i}n^ia^{b-i} = \Theta(n^b) + a^b = \Theta(n^b)

Exercises 3.1-1

Filed under: 3.1 — yuhanlyu @ 3:45 am

Suppose that f(n) is larger than g(n) asymptotically. Then max(f(n), g(n)) = Θ(f(n)) = Θ(f(n) + g(n))

Blog at WordPress.com.