When Dynamic Programming Approach Is Used?

When Dynamic Programming Approach Is Used?

Dynamic programming is used where we have problems, which can be divided into similar sub-problems, so that their results can be re-used. Mostly, these algorithms are used for optimization. Before solving the in-hand sub-problem, dynamic algorithm will try to examine the results of the previously solved sub-problems.

When can we use dynamic programming approach?

We use dynamic programming approach when. We need an optimal solution. The solution has optimal substructure. The given problem can be reduced to the 3-SAT problem.

In which situations dynamic programming can be applied explain with an example?

Example: Matrix-chain multiplication. Dynamic Programming is a powerful technique that can be used to solve many problems in time O(n2) or O(n3) for which a naive approach would take exponential time. (Usually to get running time below that—if it is possible—one would need to add other ideas as well.)

Sophia Al-Mansoor
Author

Sophia Al-Mansoor

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.