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 direct recursion?
Think about functions that refer to themselves.
What is a base case in recursion?
What makes recursion stop?
What does a base case do in recursion?
Remember the definition of the base case.
Direct recursion involves a function calling itself directly.
Think about what 'direct' means in this context.
Design a recursive function to compute the nth Fibonacci number. Explain how it leverages direct recursion.
Break down Fibonacci into definitions of previous numbers.
Consider the factorial function. Optimize it using memoization: how would that change the recursive approach?
Think about storing results to avoid recalculating them.
5 more questions in this section. Enroll free to practise them all.
Enroll free