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

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

18.04.2013 Views

Expressing Algorithms Next: Keeping Score Up: Introduction to Algorithms Previous: Efficiency Expressing Algorithms Describing algorithms requires a notation for expressing a sequence of steps to be performed. The three most common options are (1) English, (2) pseudocode, or (3) a real programming language. Pseudocode is perhaps the most mysterious of the bunch, but it is best defined as a programming language that never complains about syntax errors. All three methods can be useful in certain circumstances, since there is a natural tradeoff between greater ease of expression and precision. English is the most natural but least precise language, while C and Pascal are precise but difficult to write and understand. Pseudocode is useful because it is a happy medium. The correct choice of which notation is best depends upon which of the three methods you are most comfortable with. I prefer to describe the ideas of an algorithm in English, moving onto a more formal, programming-language-like pseudocode to clarify sufficiently tricky details of the algorithm. A common mistake among my students is to use pseudocode to take an ill-defined idea and dress it up so that it looks more formal. In the real world, you only fool yourself when you pull this kind of stunt. The implementation complexity of an algorithm is usually why the fastest algorithm known for a problem may not be the most appropriate for a given application. An algorithm's implementation complexity is often a function of how it has been described. Fast algorithms often make use of very complicated data structures, or use other complicated algorithms as subroutines. Turning these algorithms into programs requires building implementations of every substructure. Each catalog entry in Section points out available implementations of algorithms to solve the given problem. Hopefully, these can be used as building blocks to reduce the implementation complexity of algorithms that use them, thus making more complicated algorithms worthy of consideration in practice. Next: Keeping Score Up: Introduction to Algorithms Previous: Efficiency Algorithms Mon Jun 2 23:33:50 EDT 1997 file:///E|/BOOK/BOOK/NODE10.HTM [19/1/2003 1:28:07]

Keeping Score Next: The RAM Model of Up: Introduction to Algorithms Previous: Expressing Algorithms Keeping Score Algorithms are the most important, durable, and original part of computer science because they can be studied in a language- and machine-independent way. This means that we need techniques that enable us to compare algorithms without implementing them. Our two most important tools are (1) the RAM model of computation and (2) asymptotic analysis of worst-case complexity. This method of keeping score will be the most mathematically demanding part of this book. However, it is important to understand why we need both of these tools to analyze the performance of algorithms. Once you understand the intuition behind these ideas, the formalism becomes a lot easier to deal with. ● The RAM Model of Computation ● Best, Worst, and Average-Case Complexity Algorithms Mon Jun 2 23:33:50 EDT 1997 file:///E|/BOOK/BOOK/NODE11.HTM [19/1/2003 1:28:07]

Keeping Score<br />

Next: <strong>The</strong> RAM Model of Up: Introduction to <strong>Algorithm</strong>s Previous: Expressing <strong>Algorithm</strong>s<br />

Keeping Score<br />

<strong>Algorithm</strong>s are the most important, durable, and original part of computer science because they can be<br />

studied in a language- and machine-independent way. This means that we need techniques that enable us<br />

to compare algorithms without implementing them. Our two most important tools are (1) the RAM<br />

model of computation and (2) asymptotic analysis of worst-case complexity.<br />

This method of keeping score will be the most mathematically demanding part of this book. However, it<br />

is important to understand why we need both of these tools to analyze the performance of algorithms.<br />

Once you understand the intuition behind these ideas, the formalism becomes a lot easier to deal with.<br />

● <strong>The</strong> RAM Model of Computation<br />

● Best, Worst, and Average-Case Complexity<br />

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

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

file:///E|/BOOK/BOOK/NODE11.HTM [19/1/2003 1:28:07]

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

Saved successfully!

Ooh no, something went wrong!