04.09.2013 Views

Algorithm Design

Algorithm Design

Algorithm Design

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

250<br />

Chapter 5 Divide and Conquer<br />

(1985) and de Berg eta!. (1997) give many further examples of this technique<br />

in the design of geometric algorithms.<br />

The algorithm for multiplying two n-bit integers in subquadrafic time is<br />

due to Karatsuba and Ofrnan (1962). Further background on asymptotically fast<br />

multiplication algorithms is given by Knuth (!997b). Of course, the number<br />

of bits in the input must be sufficiently large for any of these subquadrafic<br />

methods to improve over the standard algorithm.<br />

Press et al. (1988) provide further coverage of the Fast Fourier Transform,<br />

including background on its applications in signal processing and related areas.<br />

Notes on the Exercises Exercise 7 is based on a result of Donna Llewellyn,<br />

Craig Tovey, and Michael Trick.<br />

Chapter<br />

Dynamic Programmiag<br />

We began our study of algorithmic techniques with greedy algorithms, which<br />

in some sense form the most natural approach to algorithm design. Faced with<br />

a new computational problem, we’ve seen that it’s not hard to propose multiple<br />

possible greedy algorithms; the challenge is then to determine whether any of<br />

these algorithms provides a correct solution to the problem in all cases.<br />

The problems we saw in Chapter 4 were al! unified by the fact that, in the<br />

end, there really was a greedy algorithm that worked. Unfortunately, this is far<br />

from being true in general; for most of the problems that one encounters, the<br />

real difficulty is not in determining which of several greedy strategies is the<br />

right one, but in the fact that there is no natural greedy algorithm that works.<br />

For such problems, it is important to have other approaches at hand. Divide<br />

and conquer can sometimes serve as an alternative approach, but the versions<br />

c,~apter are often not s~ong<br />

enough to reduce exponent,i..~~te4~~earc~own to polynomial time.<br />

Rather, as we noted in Chapt~~~~/s there tended to reduce a<br />

running time that was unnecessarily large, b--fi-t already polynomial, down to a<br />

faster nmning time.<br />

We now turn to a more powerful and subtle design technique, dynamic<br />

programming. It will be easier to say exactly what characterizes dynamic programming<br />

after we’ve seen it in action, but the basic idea is drawn from the<br />

intuition behind divide and conquer and is essentially the opposite of the<br />

greedy strategy: one implicitly explores the space of all possible solutions, by<br />

carefully decomposing things into a series of subproblems, and then building<br />

up correct solutions to larger and larger subproblems. In a way, we can<br />

thus view dynamic programming as operating dangerously close to the edge of

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!