Recursion Flashcards
1
Q
What is recursion
A
Recursion is basically a function calling itself to a smaller subset of the problem until the entire problem is solved.
2
Q
What are the required components in a recursive function
A
- Base case when the recursion will end.
- A recursive function must take parameter to allow it to only resolve a smaller problem.
- It has to combine the result of the previous call to the current call.
- Return the final answer of the function call.