====== Chapter 6: Dynamic Programming ====== ===== Chapter 6 Front Matter and Section 6.1: Weighted Interval Scheduling, a Recursive Approach ===== The basic idea behind dynamic programming is similar to that of divide and conquer and opposite to that of greedy: dynamic programming divides the problem into subproblems and then takes the solutions to those to create the solution to the larger problem. This leads us to think that the dynamic programming approach may reach up to the brute force search time, however we will never actually need to examine every solution to our problem explicitly. ===== 6.1 a Recursive Approach to Weighted Interval Scheduling ===== First, some notation to assist discussion. We will call p(j) the largest index ii, n be the error for this last segment, we can say that the optimal solution for nth point is the error of segment i to n plus our penalty for adding a new segment plus the optimal solution for all the points up to point i. To be completely honest, I am not completely sure what statement 6.7 in the book is saying, so I will look back over that at a later time.. The algorithm uses O(n3) time to calculate the error for each pair of points, however once this is calculated it runs in O(N2) time.