Vous êtes sur la page 1sur 2

Assignment #1 CS4/531, Fall 2013

Due Date: Monday, Sep 16, 2013 UNSUPPORTED SOLUTIONS RECEIVE NO CREDIT. Total points: 30 Note: The problems marked 0 points will not be collected nor graded. However, it is very important for you to do these problems as if they were to be graded. (Because similar problems will appear in exams). Detailed solutions to all problems (including 0 point problems) will be provided.

Guideline for all homework assignments Print your name, and UB number on the rst page. The solutions can be hand-written, but must be legible. Present the solutions in sequential order. Make sure the problem number is clearly marked, and leave space between problems. If you do not follow these guidelines, TA may deduct up to 20% of points. 1. (16 pts) Rank the following functions by decreasing order of growth rates. More precisely, order the functions as g1 (n), g2 (n), g3 (n), . . ., such that g1 (n) = O(g2 (n)) = O(g3 (n)) . . .. Partition your list into equivalent classes so that f (n) and g(n) are in the same class if and only if f (n) = (g(n)). ( 2)lg n , n2 , n!, (3/2)n , lg2 n, lg lg n, nlg lg n , lg n, 2lg n , (lg n)(lg n) , 4lg n , (n + 1)!, n, 2n , n lg n. Note 1. The easiest way to present your answer: list the functions in the order of increasing growth rate. Then compare the pairs of consecutive functions in the list. Note 2. You must prove your answer (by limit test or other means). 2. (4 pts) Let f (n) and g(n) be asymptotically positive functions. Prove or disprove each of the following conjectures. (a) (0 pts) f (n) = O(g(n)) implies g(n) = O(f (n)). (b) (0 pts) f (n) + g(n) = (min(f (n), g(n))). (c) (1 pts) f (n) = O(g(n)) implies lg(f (n)) = O(lg(g(n))), where lg(g(n)) 1 and f (n) 1 for all suciently large n. (d) (1 pts) f (n) = O(g(n)) implies 2f (n) = O(2g(n) ). (e) (1 pts) f (n) = O((f (n))2 ). (f ) (0 pts) f (n) = O(g(n)) implies g(n) = (f (n)). (g) (1 pts) f (n) = (f (n/2)). (h) (0 pts) f (n) + o(f (n)) = (f (n)). 3. (0 pts) The number of distinct ways of choosing n objects from 2n objects is given by:

2n n Using Stirlings formula, prove 2n n =

(2n)! n! n!

4n n1/2

4. (0+3=3 pts) Give asymptotically tight bounds on the following summations (by using the integral method.) (a) (b)
n 2.5 k =1 k

8k + 4

n k =1 k ln k

5. (4 pts) Give asymptotic upper and lower bounds for T (n) in each of the following recurrences. Assume that T (n) is constant for n 2. Make your bounds as tight as possible, and justify your answers. (a) (0 pts) T (n) = 2T (n/2) + n3 . (b) (0 pts) T (n) = T (9n/10) + n. (c) (0 pts) T (n) = 16T (n/4) + n2 . (d) (0 pts) T (n) = 7T (n/3) + n2 . (e) (1 pts) T (n) = 7T (n/2) + n2 . (f ) (1 pts) T (n) = 2T (n/4) + n. (g) (1 pts) T (n) = T (n 1) + n. (h) (1 pts) T (n) = T ( n) + 1. Note 3. The rst six recurrence relations can be solved by using the Master Theorem. The last two cannot and you have to use other methods to solve them. 6. (0+3 = 3 pts) (a) The sequence < an > is dened by: a0 = 1, a1 = 2 and, for n 2, an = 3an1 2an2 . The rst few terms of the sequence are: 1, 2, 4, 8 ... Find the closed form for an . (b) The sequence < bn > is dened by: b0 = 1, b1 = 2, b2 = 3 and, for n 3, bn = 3bn1 4bn3 . The rst few terms of the sequence are: 1, 2, 3, 5, 7, 9 ... Find the closed form for bn . 7. (0 pts) (a) Give an example of functions f (n) and g(n) satisfying the following conditions: limn f (n) = and limn g(n) = . f (n) = O(g(n)), f (n) = (g(n)) and f (n) = o(g(n)). (b) Give an example of functions f (n) and g(n) satisfying the following conditions: limn f (n) = and limn g(n) = . f (n) = (g(n)), but limn
f (n) g (n)

= c for any constant c.

Vous aimerez peut-être aussi