Algorithms help us solve problems. There are many ways to design them, a method that I did not know until recently and that has been very interesting to know is the dynamic programming. The fundamental idea of dynamic programming is to divide the problem into subproblems and then calculate each subproblem once. There are two approaches: top-down and bottom-up. Dynamic programming allows us to solve problems faster than with brute force, spending much more computer memory instead.
As explained thus, it is a little abstract, we are going to try to solve a classic dynamic programming problems, the knapsack problem (or the knapsack).