Dynamic Problem Approaches Flashcards
1
Q
Memoization (Top-Down DP)
A
Start with the problem and break it into smaller subproblems, caching the results to avoid redundant calculations.
Example:
Fibonacci with memoization.
2
Q
Tabulation (Bottom-Up DP)
A
Iteratively solve smaller subproblems first and store their solutions in a table, building up to the solution of the main problem.
Example:
LCS, Knapsack problem.
3
Q
State Transition DP
A
Used in more complex problems where multiple states are involved (e.g., DP on trees, graphs, or paths).
Example:
Longest Increasing Subsequence.
4
Q
Greedy + DP
A
Combining greedy strategies with dynamic programming when greedy alone isn’t sufficient.
Example:
Weighted Job Scheduling with profit maximization.