Algorithm Analysis

Tom Kelliher, CS23

Apr. 21, 1996

Algorithm analysis covers:

What determines running time?

Questions:

Execution Time

Examples

What should we count?

Counting

How many times does the inner loop body execute?

for (i = 0; i < n; ++i)
   for (j = 0; j < i; ++j)
      ; // inner loop body

Find closed forms for:

Growth Rates

Examples of problems that grow at these rates?

The Order of an Algorithm

Definition:

if constants c and exist such that for all .

Consequences:

Examples:

A fallacious example: is O.

Another: is O.

Typical growth rates (from slowest to fastest)

Worst-case analysis.

Average-case analysis.

Perspective

Why use a difficult, subtle, fast algorithm on small inputs?

Application

What is the efficiency of

Exercises

Implement merge sort (don't look in the textbook!).



Thomas P. Kelliher
Sat Apr 19 13:42:29 EDT 1997
Tom Kelliher