book cover

Aha! Algorithms
(A Sketch of Column 2 of Programming Pearls)

The study of algorithms offers much to the practicing programmer. A course on the subject equips students with functions for important tasks and techniques for attacking new problems. We'll see in later columns how advanced algorithmic tools sometimes have a substantial influence on software systems, both in reduced development time and in faster execution speed.

As crucial as those sophisticated ideas are, algorithms have a more important effect at a more common level of programming. In his book Aha! Insight (from which I stole my title), Martin Gardner describes the contribution I have in mind: ``A problem that seems difficult may have a simple, unexpected solution.'' Unlike the advanced methods, the aha! insights of algorithms don't come only after extensive study; they're available to any programmer willing to think seriously before, during and after coding.

The Rest of the Column


2.1 Three Problems
2.2 Ubiquitous Binary Search
2.3 The Power of Primitives
2.4 Getting It Together: Sorting
2.5 Principles
2.6 Problems
2.7 Further Reading
2.8 Implementing an Anagram Program

The teaching material contains overhead transparencies describing the vector rotation algorithm in Section 2.3; the slides are available in both Postscript and Acrobat. It also contains material on the anagram algorithm in Sections 2.4 and 2.8; the slides are available in both Postscript and Acrobat.

The code for Column 2 contains the programs for generating anagrams and a program for timing several vector rotation algorithms.

Copyright © 1999 Lucent Technologies. All rights reserved. We 6 Oct 1999