Give asymptotic upper and lower bounds for the following recurrences with the assumption that T(n) is constant for n<=2. a) T(n)= T(n/3)+n sol: Assume that n=3^k for some k. Using iterated substitution we get: T(3^k)= T(3^{k-1}) + 3^k = T(3^{k-2}) + 3^{k-1} + 3^k .... = T(1) + \sum_{i=1}^k (3)^i = T(1) + (3^{k+1}-1)/2 - 1 Assuming that T(1)=c and Since k=log_3 n, we guess that T(n) = (3n-1)/2 + c - 1 Now we prove this by induction (assuming that n=3^k again). (Do the induction!). This implies that T(n) \in \Theta(n) b) T(n)=2T(n/4)+\sqrt{n} sol: Using iterative substituion and assuming that n=4^k for some k we get: T(4^k)=2*T(4^{k-1}) + \sqrt{4^k} =2*[2*T(4^{k-2} + \sqrt{4^{k-1}}] + \sqrt{4^k} =2^2 * T(4^{k-2}) + \sqrt{4^k} + \sqrt{4^k} ... = 2^k T(4^0) + k*\sqrt{4^k} So with T(1)=c (for some constant c), since 2^k = \sqrt{n} we guess: T(n)=\sqrt{n}(k+c) Now we prove this by induction. This implies T(n)\in \Theta(\sqrt{n}\log n) c) T(n)=T(\sqrt{n})+1 Sol: Assume that n=2^k then we can write the recurrence as: T(2^k)=T(2^{k/2})+1 =T(2^{k/4})+1+1 = T(2^{k/2^2})+2 =T(2^{k/8})+1+2 = T(2^{k/2^3})+3 .... =T(2^{k/2^i})+i ... Assume further that k=2^p. If we continue until i=p we get T(2^k)=T(2^{k/2^p})+p Since k/2^p=1 we have T(2^k)=T(2^1)+p = T(2)+p Now we prove this by inudction on p, i.e. prove T(2^{2^p})=T(2)+p for p>=0. Base case: k=1 is easy Ind. Step: assume it is true for k=2^p, i.e. T(2^{2^p})=T(2)+p prove it for k=2^{p+1}: T(2^{2^{p+1}})=T(2^{2^p})+1 = T(2)+(p+1) as wanted. Because T(2) is a constant T(2^{2^p})\in \Theta(p). Since n=2^k and k=2^p, thus T(n)\in \Theta(log log n). d) T(n)=T(n-1)+lg n (lg means log_2 here). sol: we use iterated substitution: T(n)=T(n-1) + lg n =T(n-2) + lg (n-1) + lg n =T(n-3) + lg (n-2) + lg (n-1) + lg n .... =T(1) + lg 2 + lg 3 + ... + lg n We use induction to prove that T(n)=T(1) + \sum_{i=2}^n lg i (prove this for the student). Since T(1) is a constant and because lg i <= lg n for every i<=n, this implies that T(n) \in O(n lg n) = O(n log n) On the other hand if we consider the last n/2 terms in the above summation we have: T(n)>= sum_{i=n/2}^n lg i >= sum_{i=n/2}^n lg (n/2) = (n/2)lg(n/2) = (n/2)(lg n - 1)= (n/2)lg n - (n/2). Since (n/2)lg n is the dominant term T(n)\in \Omega (n lg n) = \Omega(n log n).