3. • It's a powerful algorithm
technique.
• •Used for Optimization
problems
• Solve complex problems by
breaking them into smaller
subproblems.
• Optimal substructure and
overlapping subproblems.
INTRODUCTION
5. Optimal Substructure means we
can break a big problem into smaller
subproblems, and if we solve those
smaller subproblems optimally, we
can combine their solutions to solve
the big problem optimally.
OPTIMAL SUBSTRUCTURE:
EXAMPLE: JIGSAW PUZZLE
6. Overlapping Subproblems refers to
the situation where the same smaller
problems are encountered and solved
multiple times when solving a larger
problem.It's about reusing solutions to
avoid redundant work.
OVERLAPPING SUBPROBLEMS
7. Memoization(Top-Down)
A lookup table is maintained and
checked before computation of any
state.Recursion is involved.
WAYS TO HANDLE OVERLAPPING SUBPROBLEMS
Tabulation(Bottom-Up)
Solution is built from base.It is an
iterative process.
8. Dynamic programming, specifically memoization or
tabulation, helps here by storing the results of these
subproblems the first time you solve them.When you
need the same result again, you simply look it up,
avoiding redundant calculations.This significantly
improves efficiency, especially for larger problems.
9. • Space complexity
• Complexity of identifying subproblems
• Inability to handle problems without
optimal substructure:
LIMITATIONS
LIMITATIONS
10. • Efficiency: It can improve the efficiency of
algorithms by avoiding redundant computations.
• Optimality: The algorithms are guaranteed to
find optimal solutions to problems with optimal
substructure.
• Generality: Dynamic programming can be
applied to a wide variety of problems.
ADVANTAGES
ADVANTAGES