18.04.2013 Views

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

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.

Breaking Problems Down<br />

Next: Dynamic Programming Up: Techniques Previous: Implementation Challenges<br />

Breaking Problems Down<br />

One of the most powerful techniques for solving problems is to break them down into smaller, more<br />

easily solved pieces. Smaller problems are less overwhelming, and they permit us to focus on details that<br />

are lost when we are studying the entire problem. For example, whenever we can break the problem into<br />

smaller instances of the same type of problem, a recursive algorithm starts to become apparent.<br />

Two important algorithm design paradigms are based on breaking problems down into smaller problems.<br />

Dynamic programming typically removes one element from the problem, solves the smaller problem,<br />

and then uses the solution to this smaller problem to add back the element in the proper way. Divide and<br />

conquer typically splits the problem in half, solves each half, then stitches the halves back together to<br />

form a full solution.<br />

Both of these techniques are important to know about. Dynamic programming in particular is a<br />

misunderstood and underappreciated technique. To demonstrate its utility in practice, we present no<br />

fewer than three war stories where dynamic programming played the decisive role.<br />

<strong>The</strong> take-home lessons for this chapter include:<br />

● Many objects have an inherent left-to-right ordering among their elements, such as characters in a<br />

string, elements of a permutation, points around a polygon, or leaves in a search tree. For any<br />

optimization problem on such left-to-right objects, dynamic programming will likely lead to an<br />

efficient algorithm to find the best solution.<br />

● Without an inherent left-to-right ordering on the objects, dynamic programming is usually<br />

doomed to require exponential space and time.<br />

● Once you understand dynamic programming, it can be easier to work out such algorithms from<br />

scratch than to try to look them up.<br />

● <strong>The</strong> global optimum (found, for example, using dynamic programming) is often noticeably better<br />

than the solution found by typical heuristics. How important this improvement is depends upon<br />

your application, but it can never hurt.<br />

● Binary search and its variants are the quintessential divide-and-conquer algorithms.<br />

file:///E|/BOOK/BOOK/NODE42.HTM (1 of 2) [19/1/2003 1:27:43]

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

Saved successfully!

Ooh no, something went wrong!