Recursion Flashcards
(3 cards)
1
Q
What is the key structure of a recursive function ?
A
Base case - stopping point,
Recursive case - breaks the problem into smaller subproblems and calls itslef on them.
2
Q
Explain the divide and conquer method.
A
Divide the problem into smaller subproblems,
Conquer by solving the subproblems recursively,
Combine the solutions to form the final answer.
3
Q
Is recursion efficient ?
A
Yes and No; depends on the problem,
Problem wtih simple iterative solutions - efficient.