# Take log loggx log c vx b therefore logfx log c loggx

• 14

This preview shows page 8 - 10 out of 14 pages.

Take log: log|g(x)| > log C, Vx > b, therefore: log|f(x)| <= log C + log|g(x)| <= log|g(x)| + log| (g(x))| = 2log|g(x)|. So there are constants 2 and b such that log|f(x)| <= 2log |g(x)|, x > b. thus, log|f(x)| is O(log|g(x)|). Hence, proved.
42. Suppose that f (x) is O(g(x)). Does it follow that 2f (x) is O(2g(x))?
43. Let f1(x) and f2(x) be functions from the set of real numbers to the set of positive real numbers. Show that if f1(x) and f2(x) are both theta(g(x)), where g(x) is a function from the set of real numbers to the set of positive real numbers, then f1(x) + f2(x) is theta(g(x)). Is this still true if f1(x) and f2(x) can take negative values? 3.3 – Complexity of Algorithms: 1. Give a big-O estimate for the number of operations (where an operation is an addition or a multiplication) used in this segment of an algorithm.
operation. We see that the only addition operation happens in the last line of the program segment. The outer loop runs for 3-time steps and the inner loop runs for 4-time steps. This amount to a total of 3 x 4 = 12 operations. Since this is a constant number, the complexity of the given algorithm is O(1). 2. Give a big-O estimate for the number additions used in this segment of an algorithm. j