Save
Upgrade to remove ads
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Recursion

QuestionAnswer
What is recursion? Recursion is where a function calls itself
How is recursion different from a loop? Which is better for performance? It can accomplish the same thing as a loop, but it makes the solution clearer There is no performance benefit to using recursion (loops may in fact be better), but it can make the program easier to read.
What are the 2 parts of a recursive function? Recursive functions consist of a base case and recursive case. Recursive case is when the function calls itself. Base case is when the function stops calling itself so it doesn’t go into an infinite loop.
What is a stack? A simple data structure w/ a predefined capacity. It allows adding and removing objects in a particular order. Items can only be added to the top of the stack, and the only element that can be removed is the element at the top of the stack
What's a good analogy for a stack? A pile of post-it notes. You can only add notes to the top of the stack, and the last one added must be the first removed.
What are the 2 operations for a stack? push and pop
Describe the call stack When a function is called, a certain amount of memory is set aside for that function to use for purposes such as storing local variables. It is also used by the computer to store info about the function, like the function's address in memory.
Why do recursive functions have the tendency to use a lot of memory? Keeping track of the information about active functions and their variables can use up a lot of memory if the recursion goes many levels deep. If you have a lot of function calls, your program will run significantly slower.
Created by: snailssnooze123
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards