# ch6 - Chapter 6 Dynamic Programming We began our study of...

This preview shows pages 1–3. Sign up to view the full content.

Chapter 6 Dynamic Programming We began our study of algorithmic techniques with greedy algorithms, which in some sense form the most natural approach to algorithm design. Faced with a new computational problem, we’ve seen that it’s not hard to propose multiple possible greedy algorithms; the challenge is then to determine whether any of these algorithms provides a correct solution to the problem in all cases. The problems we saw in Chapter 4 were all uni±ed by the fact that, in the end, there really was a greedy algorithm that worked. Unfortunately, this is far from being true in general; for most of the problems that one encounters, the real dif±culty is not in determining which of several greedy strategies is the right one, but in the fact that there is no natural greedy algorithm that works. For such problems, it is important to have other approaches at hand. Divide- and-conquer can sometimes serve as an alternative approach, but the versions of divide-and-conquer that we saw in the previous chapter are often not strong enough to reduce exponential brute-force search down to polynomial time. Rather, as we noted in Chapter 5, the applications there tended to reduce a running time that was unnecessarily large, but already polynomial, down to a faster running time. We now turn to a more powerful and subtle design technique, dynamic programming . It will be easier to say exactly what characterizes dynamic pro- gramming after we’ve seen it in action, but the basic idea is drawn from the intuition behind divide-and-conquer and is essentially the opposite of the greedy strategy: one implicitly explores the space of all possible solutions, by carefully decomposing things into a series of subproblems , and then build- ing up correct solutions to larger and larger subproblems. In a way, we can thus view dynamic programming as operating dangerously close to the edge of Kleinberg & Tardos frst pages 2005/2/1 11:06 p. 251 (chap06) WindFall SoFtware, PCA ZzT E X 11.6

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
252 Chapter 6 Dynamic Programming brute-force search: although it’s systematically working through the exponen- tially large set of possible solutions to the problem, it does this without ever examining them all explicitly. It is because of this careful balancing act that dynamic programming can be a tricky technique to get used to; it typically takes a reasonable amount of practice before one is fully comfortable with it. With this in mind, we now turn to a Frst example of dynamic program- ming: the Weighted Interval Scheduling Problem that we deFned back in Section 1.2. We are going to develop a dynamic programming algorithm for this problem in two stages: Frst as a recursive procedure that closely resembles brute-force search; and then, by reinterpreting this procedure, as an iterative algorithm that works by building up solutions to larger and larger subproblems.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 85

ch6 - Chapter 6 Dynamic Programming We began our study of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online