14. Given f (n) = Θ (h (n) ) and g (n) = Θ (h (n) )
14. Given f (n) = Θ (h (n) ) and g (n) = Θ (h (n) )
e. If the statement is false give a counterexample. Assume that the functions f, g and h take on only positive values. 1. 2.
f (n) (h(n)) and g (n) (h(n)), then f (n) g (n) (h(n)) f (n) ( g (n)) and g (n) ( f (n)), then f (n) ( g (n))
SOLN. 14. Given f(n) = (h(n)) and g(n) = (h(n)) Show that f(n) + g(n) = (h(n)) f(n) = (h(n)) C1 | h(n) | | f(n) | C2 | h(n) | where C1 and C2 are constants C4 | h(n) | where C3 and C4 are constants (C2 + C4) | h(n) |
| f(n) | + | g(n) |
| f(n) | + | g(n) | C6 | h(n) | where C5 and C6 are constants As f, g and h take on only positive values | f(n) | + | g(n) | = | f(n) + g(n) | Therefore C5 | h(n) | | f(n) + g(n) | C6 | h(n) | f(n) + g(n) = (h(n))
15. Given f(n) = O(g(n)) and g(n) = O(f(n)) Show that f(n) = (g(n)) f(n) = O(g(n)) | f(n) | g(n) = O(f(n))
| g(n) |
C3 | g(n) | C3 | g(n) |
C1 | g(n) |
OR As
f(n)