Question

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).

          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).
        
Show more…

Added by Mario D.

Calculus: Early Transcendentals
Calculus: Early Transcendentals
James Stewart 8th Edition
AceChat toggle button
Close icon
Ace pointing down

Please give Ace some feedback

Your feedback will help us improve your experience

Thumb up icon Thumb down icon
Thanks for your feedback!
Profile picture
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).
Close icon
Play audio
Feedback
Powered by NumerAI
David Collins Ivan Kochetkov
Jennifer Stoner verified

Sri K and 75 other subject Calculus 3 educators are ready to help you.

Ask a new question

*

Labs

-

Want to see this concept in action?

NEW

Explore this concept interactively to see how it behaves as you change inputs.

View Labs

*

Key Concepts

-
Key Concept
Premium Feature
Explore the core concept behind this problem.
Play button
Key Concept
Premium Feature
Explore the core concept behind this problem.
Your browser does not support the video tag.

*

Recommended Videos

-
given-the-following-recurrence-relation-m-an-6an-1-12an-2-8an-3-n-12-knowing-that-the-solution-of-the-associated-bomogenous-equation-is-an-a2n-bnz-yn22-then-a-particular-solution-of-m-is-giv-72456

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-an-1-for-n-2-1-and-2-b-2-48n-1-74-an-2-for-n-2-2-and-081-1-c-48-2-for-n-2-2-and-a-081-4-a-the-solution-is-given-by-83976

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-tnn-t2n-2-with-initial-condition-t16-when-n2k-for-some-integer-k-leftt

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. $]$

Discrete Mathematics and its Applications

Advanced Counting Techniques

Solving Linear Recurrence Relations


*

Recommended Textbooks

-
Calculus: Early Transcendentals

Calculus: Early Transcendentals

James Stewart 8th Edition
achievement 1,025 solutions
Calculus: Early Transcendentals

Calculus: Early Transcendentals

William Briggs, Lyle Cochran, Bernard Gillet 3rd Edition
achievement 1,281 solutions
Thomas Calculus

Thomas Calculus

George B. Thomas Jr. 14th Edition
achievement 1,219 solutions

*

Transcript

-
00:01 Hello everyone so the answer is t n is equal to t n minus 1 plus 1 so this is the recurrence relation for math therefore t 1 is equal to 1 so t n is equal to t n minus 1 plus 1 that is equal to t n minus 2 plus 1 plus 1 that is equal to t n minus 2 plus 1 plus 1 that is equal to…
Need help? Use Ace
Ace is your personal tutor. It breaks down any question with clear steps so you can learn.
Start Using Ace
Ace is your personal tutor for learning
Step-by-step explanations
Instant summaries
Summarize YouTube videos
Understand textbook images or PDFs
Study tools like quizzes and flashcards
Listen to your notes as a podcast
Continue solving this problem
Create a free account to:
  • View full step-by-step solution
  • Ask follow-up questions with Ace AI
  • Save progress and study later
Continue Free
Numerade

Get step-by-step video solution
from top educators

Continue with Clever
or



By creating an account, you agree to the Terms of Service and Privacy Policy
Already have an account? Log In

A free answer
just for you

Watch the video solution with this free unlock.

Numerade

Log in to watch this video
...and 100,000,000 more!


EMAIL

PASSWORD

OR
Continue with Clever