Recall & Review
beginner
What is recursion in problem solving?
Recursion is a method where a function calls itself to solve smaller parts of a problem until it reaches a simple base case.
Click to reveal answer
intermediate
What does DP (Dynamic Programming) do differently from simple recursion?
DP stores results of solved subproblems to avoid repeating work, making it faster than simple recursion for problems with overlapping subproblems.
Click to reveal answer
beginner
When is a greedy algorithm the right choice?
A greedy algorithm works best when making the best local choice at each step leads to the best overall solution, without needing to reconsider previous choices.
Click to reveal answer
intermediate
What kind of problems are best solved by DP rather than greedy?
Problems with overlapping subproblems and optimal substructure, where local choices alone don’t guarantee the best global solution, are best solved by DP.
Click to reveal answer
intermediate
How can you decide between recursion, DP, and greedy for a new problem?
Check if the problem has overlapping subproblems and optimal substructure (use DP), if local best choices lead to global best (use greedy), or if it’s simple and small (recursion may be enough).
Click to reveal answer
Which approach stores results to avoid repeated work?
✗ Incorrect
Dynamic Programming saves results of subproblems to avoid recalculating them.
When is a greedy algorithm NOT suitable?
✗ Incorrect
Greedy fails if local best choices don’t lead to the best overall solution.
What is a base case in recursion?
✗ Incorrect
Base case stops recursion by providing a direct answer.
Which property means a problem can be broken into smaller similar problems?
✗ Incorrect
Optimal substructure means the best solution can be built from best solutions of subproblems.
What is overlapping subproblems in DP?
✗ Incorrect
Overlapping subproblems means the same smaller problems repeat, so storing results helps.
Explain how to choose between recursion, dynamic programming, and greedy algorithms for solving a problem.
Think about problem structure and if repeated work happens.
You got /5 concepts.
Describe the main difference between dynamic programming and greedy algorithms.
Focus on how each approach makes decisions.
You got /4 concepts.