Dynamic Programming
https://www.hiredintech.com/classrooms/algorithm-design/lesson/40
what is dynamic programming?
In short, it's a method, which allows you to solve a problem by breaking it down into smaller sub-problems.
--> 以小见大
方法:
1. Breaking down a problem into sub-problems.
2. Two implementations
"bottom-up" where we start from the base cases and compute the values until we reach the desired value.
"top-down" in which we recursively compute the answers for smaller problems, on demand, but try to store the computed valued in order not to compute them multiple times. This technique is usually called "memoization".
what is dynamic programming?
--> 以小见大
方法:
1. Breaking down a problem into sub-problems.
2. Two implementations
"bottom-up" where we start from the base cases and compute the values until we reach the desired value.
"top-down" in which we recursively compute the answers for smaller problems, on demand, but try to store the computed valued in order not to compute them multiple times. This technique is usually called "memoization".
Sometimes, especially for "bottom-up" implementations it is possible to store only one part of the computed values at a time and free the memory for other parts once they have served their job in the computations.
Comments
Post a Comment