A Gallery of Algorithmic Styles

Steven J. Zeil

Old Dominion University, Dept. of Computer Science

Table of Contents

1. Divide and conquer
2. Generic
3. Generate and test
4. Backtracking
4.1. Example: The 3-Houses Puzzle
4.2. A Tabular Approach to Backtracking
4.3. A Recursive Approach to Backtracking
4.4. An Iterative Framework for Backtracking
4.5. Pruning
4.6. Example: Pruning in 3-Houses
5. Convergent
6. Dynamic programming
6.1. Example: combinations
6.2. Example: Edit Distance

Suppose you have to design a brand-new algorithm to do something never done before. You could start from scratch, given the problem statement and a programming language textbook, and you might come up with something useful.

But certain distinctive styles of algorithms have arisen over the years, and being familiar with these may give you an edge in coming up with a well-designed algorithm for a new task.

We've actually seen a number of these already, but it's time to put some names to them and take stock of what we've got:

A first question we might ask about any algorithm is how it manages to process multiple pieces of data:

Among both iterative and recursive algorithms, we recognize some algorithms by an underlying idea of how they work:

Now let's look at some common forms of both iterative and recursive algorithms.


In the Forum:

(no threads at this time)