Given these methods: METHOD math1: public int math1(int n) { if (n <= 1) { return 1; } else { return (n * 2) + math1(n-1); } } METHOD math2: public int math2(int n) { if (n <= 1) { return 1; } else { return n + math1(n) * math2(n/2); } } Now set up a recurrence relation for the running time of the method math2 as a function of n. Solve your recurrence relation to specify the Big-Oh bound of math2. HINT: When doing this, the call to math1 can be replaced by the equation that you found when solving the recurrence relation for math1 in part a).
Added by Mario D.
Your feedback will help us improve your experience
Sri K and 75 other Calculus 3 educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Given the following recurrence relation (M): an = 6an-1 - 12an-2 + 8an-3 + (n + 1)2^n. Knowing that the solution of the associated homogeneous equation is an = ̑2^n + ̒n2^n + ̓n^22^n. Then a particular solution of (M) is given as: n^3(An + B)2^n (An + B)2^n the above one the above one An^22^n A2^n
Shaiju T.
Solve the recurrence relations together with the initial conditions given: a) a_n = a_{n-1} for n ≥ 1 and a_0 = 2. b) a_n = -4 a_{n-1} - 4 a_{n-2} for n ≥ 2 and a_0 = 0, a_1 = 1. c) a_n = 4 a_{n-2} for n ≥ 2 and a_0 = 0, a_1 = 4. a) The solution is given by: a_n = │ │ for all n. b) The solution is given by: a_n = │ │ for all n. c) The solution is given by: a_n = │ │ for all n.
Adi S.
Solve the recurrence relation $T(n)=n T^{2}(n / 2)$ with initial condition $T(1)=6$ when $n=2^{k}$ for some integer $k .$ $\left[\text { Hint: Let } n=2^{k} \text { and then make the substitution } a_{k}=\right.$ $\log T\left(2^{k}\right)$ to obtain a linear nonhomogeneous recurrence relation. $]$
Advanced Counting Techniques
Solving Linear Recurrence Relations
Recommended Textbooks
Calculus: Early Transcendentals
Thomas Calculus
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD