We also have to study the data, and to model the input that might be presented to the algorithm. Most often, we consider
one of two approaches to the analysis:
| Function | Description |
Graph |
| 1 |
Most instructions of most programs are executed once or at most only a few times. If all
the instructions of a program have this property, we say that the program's running time is
constant. |
N/A |
| log(N) |
When the running time of a program is logarithmic, the program gets slightly slower
as N grows. This running time commonly occurs in programs that solve a big problem by transformation
into a series of smaller problems, cutting the problem size by some constant fraction at each step. |
 |
| N |
When the running time of a program is linear, it is generally the case that a small
amount of processing is done on each input element. That is, whenever N, doubles so does the
running time. |
 |
| N*log(N) |
This timing arises usually when algorithm solves a problem by breaking it up into smaller
subproblems, solving them independently, and then combining the solutions. (When N doubles, then
the running time more [but not much more] than doubles.) |
 |
| N2 |
When the running time is quadratic, that algorithm is practical only for use on only
relatively small problems because when N doubles, the running time increases fourfold. |
 |
| 2N |
Very few algorithms with exponential time are likely to be appropriate for practical
use, even though such algorithms arise natuarally as brute-force solution to problems. Whenever N
doubles, the running time squares! |
 |
The following table shows how much time it takes to solve huge problems on machines of different speed.
In this course this notation basically will be used to say that one function is approximately equal another
(usually simpler) function when parameter N is large. For example, we can say that