Table of Contents

6.1 Weighted Interval Scheduling

6.2 Principles of Dynamic Programming

recursive): in Abstract Algebra we recently got an extra-credit problem implementing a dynamic algorithm finding the number of three-free permutations of the first n natural numbers (rather convenient timing, really). The algorithm determined, given a set of numbers yet to be placed, whether each one of them could be placed next; for each one that could, the algorithm was recursively applied to determine the number of valid solutions that placed that number next. There are really 2^n subproblems, but most of them prove inaccessible (I was able to calculate up to n=62 despite a rather memory inefficient memoization structure). An iterative algorithm there would be exponential time; the recursive algorithm was not great, but still quite workable (I do not know of a tighter bound than O(2^n) space and O(n^2*2^n) time, but it is experimentally much lower).

6.3 Segmented Least Squares

6.4 Subset Sums and Knapsacks