Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What is a base case in recursion?
Think about what prevents endless function calls.
Define recursive case.
Consider the part of the function that still performs the task.
What component allows a recursive function to stop calling itself?
Think about what prevents infinite calls.
True or False: The recursive case modifies arguments to get closer to the base case.
Consider how the function reduces the problem over time.
Create a recursive function that calculates the greatest common divisor (GCD) of two numbers using recursion.
Think about how to reduce the problem size by using a remainder.
Implement a recursive function that generates the nth number in the Tribonacci sequence, where each term is the sum of the three preceding terms.
Consider how you might build the next term from the previous three.
5 more questions in this section. Enroll free to practise them all.
Enroll free