CS2022/MA2201
HW#3

Due: Friday, September 12

1. (4 points) Do Exercise 1.8.8 from our text.

2. (4 points) Do Exercise 1.8.16 from our text.

3. (5 points) Prove or give a counterexample to the following conjecture. If you give a counterexample, you must prove that it’s a counterexample.
Conjecture: For all functions f,g:R®R, if f(x) is O(g(x)), then g(x) is O(f(x)).

4. (4 points) Is it true that  is O(n2)? Justify your response.

5. (4 points) Consider the algorithm to multiply two n-digit numbers together that you learned in grade school. 
	• Give a tight bound, using O-notation, of the time complexity of your algorithm.
	• If, using your algorithm, you can multiply together two 20-digit numbers in s 
	seconds, then how long do you expect it to take you to multiply together two
	60-digit numbers?

CS2022/MA2201
HW#3 Solutions

1. a) 4, since f(x) is O(x4).
b) 5, since f(x) is O(x5).
c) 0, since f(x) is O(x0) or O(1).
d) -1, since f(x) is O(x-1).

2. If f(x) is O(x), then there exist C and k such that  for all x>k. Choosing , we see that for all x>k’ it follows that , so f(x) is O(x2).

3. The conjecture is false. Consider f(x)=x and g(x)=x2. Choosing constants C=1 and k=1, it follows that for all n≥k, . If g(n) were O(f(n)), then there’d exist constants C, k such that for all n≥k, , which would imply that there exists a constant C such that n≤C for all n≥k, which is clearly a contradiction.

4. We saw in class that . Choosing C=1 and k=1, it follows that for all n≥k, , so  is O(n2). 

5. The complexity of the algorithm is , and multiplying two 60-digit numbers should take time 9s.