Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
What is the base case for a recursive function calculating factorial?
Think about what happens when the input is zero.
Define recursion in your own words.
Consider how a problem could be divided into simpler parts.
What is a base case in recursion?
Recall what happens if there’s no base case.
True or False: Every recursive function must have a base case.
Think about examples of recursive functions.
Design a recursive algorithm to find the greatest common divisor (GCD) of two numbers. Identify and explain the base case.
Consider properties of division regarding GCD.
Write a recursive function that counts down from a given number to zero. What is the base case and what happens if it's not defined?
Think about what happens when you reach the smallest number.
6 more questions in this section. Enroll free to practise them all.
Enroll free