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.
Define recursion in your own words.
Think about how recursion simplifies complex problems.
What is a base case in recursion?
Recall that without this, recursion lasts indefinitely.
What is the primary purpose of recursion?
Think about scenarios where repeating operations is beneficial.
True or False: Every recursive function must have a base case.
Consider what happens if there is no stopping rule.
Implement a recursive function to find the greatest common divisor (GCD) of two numbers using the Euclidean algorithm.
Think about how you can reduce the problem until you reach a fundamental case.
Write a recursive function to list all subsets of a set using recursion.
Consider each element independently — whether to include it or not.
6 more questions in this section. Enroll free to practise them all.
Enroll free