Recall & Review
beginner Click to reveal answer
What is the main idea behind the greedy approach?
The greedy approach makes the best choice at each step, hoping to find the overall best solution without reconsidering previous choices.
beginner Click to reveal answer
What does Dynamic Programming (DP) do differently from greedy algorithms?
DP solves problems by breaking them into smaller overlapping subproblems, storing their results, and combining them to find the best overall solution.
intermediate Click to reveal answer
When should you choose a greedy algorithm over DP?
Choose greedy when the problem has the greedy-choice property and optimal substructure, meaning local best choices lead to a global best solution.
beginner Click to reveal answer
What is the 'optimal substructure' property?
A problem has optimal substructure if an optimal solution can be built from optimal solutions of its subproblems.
intermediate Click to reveal answer
How can you test if a greedy algorithm will work for a problem?
Check if making the best local choice at each step always leads to a global optimum. If not, DP might be needed.
Which property must a problem have for a greedy algorithm to guarantee an optimal solution?
✗ Incorrect
The greedy-choice property means local optimal choices lead to a global optimum, which is essential for greedy algorithms.
Dynamic Programming is best used when a problem has:
✗ Incorrect
DP works well when problems have overlapping subproblems and optimal substructure.
Which approach stores results of subproblems to avoid repeated work?
✗ Incorrect
Dynamic Programming stores subproblem results to avoid recomputation.
If a problem’s local best choice does NOT always lead to a global best, which method is preferred?
✗ Incorrect
DP handles cases where local choices don’t guarantee global optimum.
Which of these is NOT a characteristic of greedy algorithms?
✗ Incorrect
Greedy algorithms do NOT reconsider previous choices once made.
Explain how to decide between using a greedy algorithm or dynamic programming for a problem.
Think about whether local best choices lead to global best and if subproblems repeat.
You got /5 concepts.
Describe the key differences between greedy algorithms and dynamic programming.
Focus on how each approach handles problem solving and decision making.
You got /4 concepts.
