Algorithm Diagram - Dynamic Programming

content:

  • Dynamic programming, which divides a problem into smaller ones and tackles those smaller problems first
  • Learn how to design dynamic programming solutions to problems

9.1 The Knapsack Problem

  How to maximize the value of the goods in the backpack?

If all possibilities are tried, the running time is O(2 n ).

9.2 FAQ about knapsack problem

  9.2.7 Dealing with interdependencies

    Dynamic programming only works if each subproblem is discrete. That is, there can be no dependencies between sub-problems.

  9.2.8 According to the design of dynamic programming, at most two self-knapsacks only need to be merged, that is, more than two sub-knapsacks are not involved at all, but the sub-knapsacks may contain sub-knapsacks.

  9.2.9 The optimal solution may cause the backpack not to be full 9

9.3 Longest Common Substring

  • Dynamic programming finds optimal solutions under given constraints
  • Dynamic programming is used when a problem can be decomposed into independent and discrete sub-problems

9.4 Summary

  • Dynamic programming is useful when you need some kind of metric in the lower right under given constraints
  • When the problem can be divided into discrete subproblems, it can be solved using dynamic programming
  • Every dynamic programming scenario involves grids
  • The value in the cell is usually the value you want to optimize
  • Each cell is a subproblem, so you need to think about how to divide the problem into subproblems
  • There is no one-size-fits-all formula for computing dynamic programming solutions

Dynamic programming C language

https://blog.csdn.net/qq_34207422/article/details/69067708

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324692453&siteId=291194637