You are on page 1of 2

Exercises 1 1. True or false?

In each case below, either show that the statement is true for all positive functions f (n) and g (n), or give a counterexample. 1. f (n) + g (n) 2 (min(f (n); g (n)): F. f (n) = 1; g (n) = n: 2. f (n) + g (n) 2 (max(f (n); g (n)) T. Use the inequality max(f (n); g (n)) f (n) + g (n) 2 max(f (n); g (n)): (nb ):
b

3. For any constants a; b > 0, (n + a)b 2 lim

a (n + a)b = lim 1 + n!1 n!1 nb n so the assertion is true.

= 1;

4. If f (n) 2 O(g (n)); then g (n) 2 ! (f (n)): F. Let f (n) = g (n) = n: Then it is easy to see that not for any constanct c > 0 and for n large enough, 0 cf (n) g (n): (take for instance c = 2). 5. If f (n) 2 o(g (n)) then g (n) 2 (f (n)): T. 6. If f (n) 2 o(g (n)) and g (n) 2 o(h(n)) then f (n) 2 o(h(n)): T. We have, according to the denition, 8c1 > 0; 9n1 such that, for any n 8c2 > 0; 9n2 such that, for any n n1 ; 0 n2 ; 0 f (n) g (n) c1 g (n) c2 h(n)

Then, for any n max(n1 ; n2 ), 0 f (n) c1 c2 h(n): Taking c1 = 1 we obtain that, for any c2 > 0; 9n0 = max(n1 ; n2 ); such that, for any n n0 , 0 f (n) c2 h(n); i.e f (n) 2 o(h(n)): 7. If f (n) 2 (g (n)) then g (n) 2 F. f (n) = n; g (n) = 1: 8. If f (n) 2 O(g (n)) and f (n) 62 F. Let g (n) = n and f (n) = (f (n)): (g (n)), then f (n) 2 o(g (n)): n; if n is even : 1; if n is odd 1

Then f (n) g (n) for any n, so f (n) 2 O(g (n)) and it is clear that f (n) 62 (g (n)): Suppose that f (n) 2 o(g (n)): Then, for any c > 0, there is a n0 > 0 such that, for any n > n0 ; 0 f (n) cg (n): Taking c = 1=2 is clear that the previous inequality does not hold. 9. There exist functions f (n) and g (n) such that f (n) 2 O(g (n)) and f (n) 2 ! (g (n)): F. If both assertions are true, then the rst one shows that there exists a constant c > 0 and an n0 such that, for any n > n0 ; f (n) cg (n): The second assertion shows that, for every constant c1 > 0, there exists an n1 such that, if n > n1 ; f (n) c1 g (n): Taking c1 = 2c, these two conditions show that, for any n > max(n0 ; n1 ), f (n) cg (n) and f (n) 2cg (n), contradiction. 2. 1. Show that, if f (n) g (n) 2 O(1);

f (n) 2 O(1): g (n) f (n) 2 O(1) g (n)

2. Give a counterexample to the following claim: if then f (n) g (n) 2 O(1):

Solution. 1. f (n) g (n) 2 O(1) means that 9C > 0, 9n0 such that, for any n > n0 ; 0 f (n) g (n) C: Then f (n) g (n) f (n) = +1 g (n) g (n) Since g (n) f (n) g (n) 2. f (n) = 2n; g (n) = n: 1 for any n, C + 1: g (n) f (n) 2 O(1): g (n)

C + 1 for any n > n0 ; so