Let's dig into the implementation of some of the theoretical programming techniques we have discussed. We start with dynamic programming.
Technical implementation
Implementation using dynamic programming
As we have already described, in this approach, we divide a given problem into smaller subproblems. In finding the solution, care is taken not to recompute any of the previously encountered subproblems.
This sounds a bit like recursion, but things are a little different here. A problem may lend itself to being solved by using dynamic programming, but will not necessarily take the form of making recursive calls.
One property that makes a problem an ideal candidate for being solved with dynamic programming is that it has...