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.

War Story: String 'em Up<br />

<strong>The</strong> take home lessons for programmers from Figure should be apparent. We isolated a single<br />

operation (dictionary string search) that was being performed repeatedly and optimized the data structure<br />

we used to support it. We started with a simple implementation (binary search trees) in the hopes that it<br />

would suffice, and then used profiling to reveal the trouble when it didn't. When an improved dictionary<br />

structure still did not suffice, we looked deeper into what kinds of queries we were performing, so that<br />

we could identify an even better data structure. Finally, we didn't give up until we had achieved the level<br />

of performance we needed. In algorithms, as in life, persistence usually pays off.<br />

Figure: Run times (in seconds) for the SBH simulation using various data structures<br />

Next: Exercises Up: Data Structures and Sorting Previous: War Story: Mystery of<br />

<strong>Algorithm</strong>s<br />

Mon Jun 2 23:33:50 EDT 1997<br />

file:///E|/BOOK/BOOK/NODE39.HTM (5 of 5) [19/1/2003 1:28:38]

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

Saved successfully!

Ooh no, something went wrong!