• Solving a large problem that is composed of smaller, overlapping, predictably ordered subproblems
    • The hard part of creating a DP solutions is identifying and applying Memoization to the subproblem(s)
    • where the storing of solutions to subproblems is called Memoization
  • In DP, we always look for an optimal substructure, where if we compute the optimal solution to the subproblems then we can compute the optimal solution of the larger more complex problem.
  • A drawback to DP is that the Auxiliary Space Complexity will be larger than normal, but this is usually okay because space is almost always cheaper than time
  • DP often involves Recursion, though this recursion might just be in the reasoning for the implementation, while the implementation may be iterative, e.g. for the Fibonacci Sequence Example, the reasoning is recursive still but the implementation is iterative.

Components of Dynamic Programming

  • Identify the optimal structure of subproblems
  • Establish an order of solving
  • Solve subproblems to solve the large problem

Fibonacci Sequence Example

Dynamic Programming Problems

Dijkstra’s Algorithm Longest Common Subsequence Bellman-Ford Algorithm Floyd-Warshall Algorithm