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
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...
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.
Give a description of the pathophysiology of lower and upper urinary tract infections, including their similarities...
Give a description of the pathophysiology of lower and upper urinary tract infections, including their similarities and differences. Then explain how the two factors( genetics, gender, ethnicity, age, or behavior) you selected might impact the pathophysiology of the infections, as well as the diagnosis of and treatment for the infections.
Describe in your own words the two terms: Lower Quartile and Upper Quartile and give an...
Describe in your own words the two terms: Lower Quartile and Upper Quartile and give an example for each of your chosen term.
Use a recursion tree to determine a good asymptotic upper bound on the following recurrences. Use...
Use a recursion tree to determine a good asymptotic upper bound on the following recurrences. Use the substitution method to verify your answer. T(n) = 3T(n/2) + n. T(n) = T(n/2) + n2.
Find the lower z score that bounds the middle 65%? Round to the fourth.
Find the lower z score that bounds the middle 65%? Round to the fourth.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT