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 939667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:49:38+00:00 2026-05-15T21:49:38+00:00

Wondering if anyone could point me towards a good recursion tutorial. I am a

  • 0

Wondering if anyone could point me towards a good recursion tutorial. I am a bit rusty on it as I learned about it in my Data Structures class first semester. Would like to brush up on my recursion…any help?

  • 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. Editorial Team
    Editorial Team
    2026-05-15T21:49:39+00:00Added an answer on May 15, 2026 at 9:49 pm

    Consider this.

    More seriously…

    Recursion is a way of solving problems that have a clearly defined base case (or cases, btu I’m keeping it simple here.)

    For examples, the commonly cited factorial problem is a great one.

    What does factorial do? Let’s see some examples:

    factorial(0) = 1
    factorial(1) = 1
    factorial(2) = 2
    factorial(3) = 6
    factorial(4) = 24
    

    The factorial of a number is that number multiplied by the factorial of the number that comes before it, unless (now, this is the base case) the number is 0. The factorial of 0 is 1. (You can’t take the factorial of a negative number; only positive integers.)

    So we have our clearly defined base case. And we know what to do with numbers that aren’t our base case (we multiply them times the factorial of the number one less than it.) We’re ready to write our function.

    def factorial(x):
        if x == 0:            # this is our base case
            return 1          # and this is what we do when we see it
        else:                 # this is what we do with all other numbers
            return x * factorial(x-1)
    

    So you

    1. Clearly define your base case.
    2. Find a way to reduce your problem from a non-base case to the base case.
    3. Formally express that in a function that (when it’s simple!) looks like

      function:
          if base case: 
              this
          else: 
              something + function(something closer to the base case)
      

    If you want something more advanced, Google’s got a lot of info.

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

Sidebar

Related Questions

I was wondering if someone could point me towards some good resources for learning
I was wondering if anyone could point to an Open Source date utility class
I was wondering if anyone could point me in the direction of some good
I was wondering if anyone could give me an example or point me to
I was wondering if anyone could tell me about the i++ operator in C#.
I was wondering if anyone could advise on a good pattern for loading textures
I was wondering if anyone could point out a cleaner better way to write
I was wondering if anyone could give me a starting point of how to
I was wondering if anyone could point me to a resource that gave an
I was wondering if anyone could point me to any resources or overviews as

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.