Vous êtes sur la page 1sur 4

CMSC 441: Homework #1 Solutions

Parag Namjoshi

Exercise 3.12
Show that for any real constants a and b, where b > 0, (n + a)b = (nb )

Solution:

(n + a)b

= =

(n + |a|)b , where n > 0 (n + n)b for n |a| (2n)b c1 nb , where c1 = 2b

Thus (n + a)b = (nb ). (n + a)b (n |a|)b , where n > 0


b (c 2 n) for c2 = 1/2 where n 2|a|

(1)

as n/2 n |a|, for n 2|a| Thus (n + a)b = O(nb ) The result follows from 1 and 2 with c1 = 2b , c2 = 2b , and n0 2|a|. (2)

Exercise 3.14
Is 2n+1 = O(2n ) ? Is 22n = O(2n )?

Solution:

(a)
Is 2n+1 = O(2n ) ? Yes. 2n+1 = 2 2n c2n where c 2.

(b)
Is 22n = O(2n ) ? No. 22n = 2n 2n . Suppose 22n = O(2n ). Then there is a constant c > 0 such that c > 2n . Since 2n is unbounded, no such c can exist.

Page 2 of 4

Exercise 3.17
Prove that o(g (n)) (g (n)) is the empty set.

Solution: Suppose not. Let f (n) o(g (n)) (g (n)) Now f (n) = (g (n)) if and only if g (n) = o(f (n)) and f (n) = o(g (n)) by assumption. By transitivity property (page 49), f (n) = o(f (n)) i.e. for all constants c > 0, f (n) < cf (n). Choose c < 1 and we have the desired contradiction from the asymptotic nonnegativity of f (n).

Exercise 3.18
We can extend our notation to the case of two parameters n and m that can go to innity independently at dierent rates. For a given function g (n, m), we denote by O(g (n, m)) the set of functions O(g (n, m)) = { f (n, m) : there exist positive constants c, n0 , and m0 such that 0 f (n, m) cg (n, m) for all n n0 and m m0 }. Give corresponding denitions for (g (n, m)) and (g (n, m))

Solution: (g (n, m)) = { f (n, m) : there exist positive constants c, n0 , and m0 such that 0 cg (n, m) f (n, m) for all n n0 and m m0 }. (g (n, m)) = { f (n, m) : there exist positive constants c1 , c2 , n0 , and m0 such that c1 g (n, m) f (n, m) c2 g (n, m) for all n n0 and m m0 }.

Exercise 3.21
Show that if f (n) and g (n) are monotonically increasing functions, then so are f (n) + g (n) and f (g (n)), and if f (n) and g (n) are in addition nonnegative, then f (n) g (n) is monotonically increasing.

Solution:

(a)
We must show that if f (n) and g (n) are monotonically increasing functions, then so is f (n) + g (n). Suppose not. Let n1 < n2 and f (n1 ) + g (n1 ) > f (n2 ) + g (n2 ). Now, f (n1 ) f (n2 ) and g (n1 ) g (n2 )

f (n1 ) f (n1 ) + g (n1 ) f (n1 ) + g (n1 ) This contradicts our assumption.

f (n2 ) f (n2 ) + g (n1 ) f (n2 ) + g (n2 )

(b)
We must show that if f (n) and g (n) are monotonically increasing functions, then so is f (g (n)). Suppose not. Let n1 < n2 and f (g (n1 )) > f (g (n2 )). Let m1 = g (n1 ), m2 = g (n2 ). m1 m2 . Clearly, Exercise 3.21 [(b)] continued on next page. . . Page 3 of 4

f (m1 ) f (m2 ), which contradicts our assumption.

(c)
We must show that if f (n) and g (n) are monotonically increasing functions, then so is f (n)g (n)) if f and g are nonnegative. Suppose not. Let n1 < n2 and f (n1 ) + g (n1 ) > f (n2 ) + g (n2 ). Now, f (n1 ) f (n2 ) and g (n1 ) g (n2 )

f (n1 ) f (n1 )g (n1 ) f (n1 )g (n1 )

f (n2 ) f (n2 )g (n1 ) f (n2 )g (n2 )

(3) (4) (5)

This contradicts our assumption. Note that 4 and 5 hold since f and g nonnegative,

Page 4 of 4

Vous aimerez peut-être aussi