Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 66725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:08:54+00:00 2026-05-10T19:08:54+00:00

Recently I have been studying recursion; how to write it, analyze it, etc. I

  • 0

Recently I have been studying recursion; how to write it, analyze it, etc. I have thought for a while that recurrence and recursion were the same thing, but some problems on recent homework assignments and quizzes have me thinking there are slight differences, that ‘recurrence’ is the way to describe a recursive program or function.

This has all been very Greek to me until recently, when I realized that there is something called the ‘master theorem’ used to write the ‘recurrence’ for problems or programs. I’ve been reading through the wikipedia page, but, as usual, things are worded in such a way that I don’t really understand what it’s talking about. I learn much better with examples.

So, a few questions: Lets say you are given this recurrence:

r(n) = 2*r(n-2) + r(n-1);
r(1) = r(2) = 1

Is this, in fact, in the form of the master theorem? If so, in words, what is it saying? If you were to be trying to write a small program or a tree of recursion based on this recurrence, what would that look like? Should I just try substituting numbers in, seeing a pattern, then writing pseudocode that could recursively create that pattern, or, since this may be in the form of the master theorem, is there a more straightforward, mathematical approach?

Now, lets say you were asked to find the recurrence, T(n), for the number of additions performed by the program created from the previous recurrence. I can see that the base case would probably be T(1) = T(2) = 0, but I’m not sure where to go from there.

Basically, I am asking how to go from a given recurrence to code, and the opposite. Since this looks like the master theorem, I’m wondering if there is a straightforward and mathematical way of going about it.

EDIT: Okay, I’ve looked through some of my past assignments to find another example of where I’m asked, ‘to find the recurrence’, which is the part of this question I’m having the post trouble with.

Recurrence that describes in the best way the number of addition operations in the following program fragment (when called with l == 1 and r == n)

int example(A, int l, int r) {   if (l == r)     return 2;   return (A[l] + example(A, l+1, r); } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T19:08:55+00:00Added an answer on May 10, 2026 at 7:08 pm

    A few years ago, Mohamad Akra and Louay Bazzi proved a result that generalizes the Master method — it’s almost always better. You really shouldn’t be using the Master Theorem anymore…

    See, for example, this writeup: http://courses.csail.mit.edu/6.046/spring04/handouts/akrabazzi.pdf

    Basically, get your recurrence to look like equation 1 in the paper, pick off the coefficients, and integrate the expression in Theorem 1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 174k
  • Answers 174k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Most likely you have gem installed in 2 different places,… May 12, 2026 at 2:53 pm
  • Editorial Team
    Editorial Team added an answer I used the Internet Explorer Developer Toolbar in IE 6… May 12, 2026 at 2:53 pm
  • Editorial Team
    Editorial Team added an answer The best answer I can offer you is to run… May 12, 2026 at 2:53 pm

Related Questions

I have been studying Java for a few months and am now starting to
Recently I have been investigating the possibilities of caching in ASP.NET. I rolled my
recently I have been encountering problems with exposing events from .NET to COM. I
Recently I have been working with a SQL Server database and I was trying

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.