A decrease-by-a-constant algorithm typically processes its input one element at a time, accumulating a solution as it goes. Such algorithms are often naturally written using iteration rather than recursion.

1. Typical recurrence

The typical recurrence for an algorithm in this class is

which has the solution (see SolvingSums)

For most reasonable functions f, this will just be Theta(n f(n)). So the key to getting a fast decrease-by-a-constant algorithm is to keep the cost of each iteration small.

2. Examples


CategoryAlgorithmNotes

DecreaseByConstant (last edited 2007-12-25 23:42:19 by localhost)