Question

In: Computer Science

Give asymptotic upper and lower bounds for T(n). Assume that T(n) is constant for n <=...

Give asymptotic upper and lower bounds for T(n). Assume that T(n) is constant for n <= 2.

Make your bounds as tight as possible, and justify your answers.

T(n) = T(n-2) + n^2

Solutions

Expert Solution

Solution:

Given,

=>T(n) = T(n-2) + n^2 for n > 2 and T(n) is constant for 2

Explanation:

Solving recurrence relation using substitution method:

=>T(n) = T(n-2) + n^2...(1)

=>T(n-2) = T(n-2*2) + (n-2)^2...(2)

From (1) and (2)

=>T(n) = T(n-2*2) + n^2 + (n-2)^2

and so on.

=>T(n) = T(n-2*k) + n^2 + (n-2)^2 + ... + (n-2*(k-1))^2.....(3)

=>Let say T(1) = 2

=>n - 2k = 1

=>k = (n-1)/2...(4)

From (3) and (4)

=>T(n) = 1 + n^2 + (n-2)^2 + ... + (n-((n-1)/2 - 1)

=>T(n) = 1 + (n^2 + (n-2)^2 + ....+ 3^2)

=>T(n) = 1^2 + 3^2 + 5^2 + .. + n^2 where n is odd

Sum of squares of first n odd numbers

=>T(n) = (n/2)*(2*(n/2) + 1)(2*(n/2) - 1)/3

=>T(n) = n*(n+1)(n-1)/6

=>Hence T(n) = (n^3)

=>Hence upper bound = O(n^3) and lower bound = (n^3)

I have explained each and every part with the help of statements attached to it.


Related Solutions

Give upper and lower bounds for T(n) in the following recurrence: T(n) = 3T(n/4) + n
Give upper and lower bounds for T(n) in the following recurrence: T(n) = 3T(n/4) + n
Give asymptotic tight bounds for T(n) in each of the following recurrences using recursion tree. a....
Give asymptotic tight bounds for T(n) in each of the following recurrences using recursion tree. a. T(n) = 2T(n − 1) + 1 b. T(n) = t(n − 1) + n c. T(n) = 2T (n/4) + √n
Use a recursion tree to determine a good asymptotic upper bound on the recurrence T(n) =...
Use a recursion tree to determine a good asymptotic upper bound on the recurrence T(n) = 2T(n/3) + 2n. Use the substitution method to verify your answer
Prove the upper and lower bound of T(n) = T(n/3) + T(2n/3) + O(n)
Prove the upper and lower bound of T(n) = T(n/3) + T(2n/3) + O(n)
Solve the following recurrence relations: (find an asymptotic upper bound O(?) for each one) a. T(n)...
Solve the following recurrence relations: (find an asymptotic upper bound O(?) for each one) a. T(n) = T(2n/3)+T(n/3) + n^2 b. T(n) = √nT(√n) + n c. T(n) = T(n-1)+T(n/2) + n The base case is that constant size problems can be solved in constant time (O(1)). You can use the induction, substitution or recursion tree method
I'm needing assistance with calculating the Chi-Squared upper and lower bounds. I'm working on an example...
I'm needing assistance with calculating the Chi-Squared upper and lower bounds. I'm working on an example in which I am trying to find a 95% confidence interval estimate for a population variance and this is what the example states: Find the chi-squared upper and lower bounds, X26, .025 =12.832 (this is the upper bound) and X26, .975 = .0831 (this is the lower bound) with 5 (=6-1) degrees of freedom (because remember, the degrees of freedom is “n-1”). Also, we...
Coefficients Standard Error t-Stat    P-value Lower 95% Upper 95% Lower 95.0% Upper 95.0% Intercept Calories...
Coefficients Standard Error t-Stat    P-value Lower 95% Upper 95% Lower 95.0% Upper 95.0% Intercept Calories Calories (x) Fat Content (y) Predicted y value Residual 140 7 5.75 1.25 160 8 6.77 1.23 70 2 2.18 -0.18 120 3.5 4.73 -1.23 170 16 7.28 8.72 290 12 13.4 -1.4 210 17 9.32 7.68 190 12 8.3 3.7 210 1.5 9.32 -7.82 130 3.5 5.24 -1.74 150 4.5 6.26 -1.76 160 12 6.77 5.23 150 7 6.26 0.74 140 6 5.75...
Recall the following theorem, phrased in terms of least upper bounds. Theorem (The Least Upper Bound...
Recall the following theorem, phrased in terms of least upper bounds. Theorem (The Least Upper Bound Property of R). Every nonempty subset of R that has an upper bound has a least upper bound. A consequence of the Least Upper Bound Property of R is the Archimedean Property. Theorem (Archimedean Property of R). For any x; y 2 R, if x > 0, then there exists n 2 N so that nx > y. Prove the following statements by using...
In the notation, <T extends Number>, the Number class A. Specifies both an upper and lower...
In the notation, <T extends Number>, the Number class A. Specifies both an upper and lower bound for the type T B. Specifies a lower bound for the parameter type T C. Specifies an upper bound for the parameter type T D. None of the above
Use a recursion tree to determine a good asymptotic upper bound on the recurrence ?(?) =...
Use a recursion tree to determine a good asymptotic upper bound on the recurrence ?(?) = 3?(?/3) + ?. Use the substitution method to verify your answer.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT