Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 1.18 KB

dynamic-programming.md

File metadata and controls

19 lines (14 loc) · 1.18 KB

Dynamic programming

{% hint style="info" %} This technique involves solving a problem by breaking it down into smaller sub-problems and then solving each sub-problem only once and sorting the solution for the future us. This can be more efficient than solving the sub-problems repeatedly. {% endhint %}

{% embed url="https://gist.github.com/Aisuko/d465737429da0cea6d80636c997e4798#file-fibonacci_with_dp-py" %} Fibonacci with dynamic programming {% endembed %}

The knapsack problem is a classic optimization problem in computer science and mathematics. The problem can be stated as follows: given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is maximized.

{% embed url="https://gist.github.com/Aisuko/395fa49c2e14de82467a7e92465ae2a9#file-knapsack_description-md" %} Knapsack question {% endembed %}

{% embed url="https://gist.github.com/Aisuko/e35848f140c403e3451565c5ab0c939b#file-knapsack_with_dp-py" %} Knapsack with dynamic programming {% endembed %}