CSCI 150, Spring 2003

Home | | Course Schedule | | Assignments | | Lecture Notes

Tractable and Intractable Problems

Limitations of Computer Science
Programming allows us to write programs to solve a large variety of problems, but in practice we cannot solve every possible problem with programming. The following are reasons not every problem is solvable with a computer program:
• The execution time of the program may be too long (e.g. years or centuries).
• The problem may be non-computable.
• We may not know how to solve the problem (e.g. problems in artificial intelligence).

Program Execution Time
The time a program takes to execute can be important as the problem sizes grow large and the problems more complex. Examples of such problems might be:

• Sorting tax forms for all tax payers in the U.S.
• Finding the most efficient routing of electricity over a grid of power lines
• Many others in research, industry, government, finance, etc.

Tractable problems can run in a reasonable amount of time (e.g. hours or days) for even very large amounts of input data (e.g. millions).

Intractable problems require huge amounts of time (e.g. centuries) for even modest input sizes (e.g. tens or hundreds of inputs).

Tractable problems
Tractable problems can be solved with programs that have a running time that increases relatively slowly with increasing amounts of input data. For example, searching through a list of items requires a computing time that increases roughly proportionately (linearly) with the number of items searched.

We can write the running time of a program as a function of the number of items in the input (the input size), which is usually given as n.

For example:

Linear running time (graph of time (t) is a line):
t = .00051 * n seconds

Polynomial running time:
t = .0021 * n^2 + .003 * n + .00004
t = 4 * n^3 + 5 * n^2 -3

Programs whose running time is a polynomial function of the input size, n, are tractable

Programs whose running time is a polynomial function of log(n) are also tractable.
log(n) is the inverse function of exponentials. If 2^x = n, then log(n) = x.
Thus, the following running times would be considered tractable:

t = 0.00021 * n * log(n)
t = n^2*(log(n))^3
t = 17*n^6 - log(n) + 6 * n

Intractable Problems
Intractable problems have running times that increase much faster than polynomial of n. For example, exponential functions (2^n) and factorials (n!).

Tower of Hanoi program (see Homework 6) has a running time that is roughly proportional to 2^n. As you increase n by 1, the running time approximately doubles. An input size of 100 would take trillions of years to run!

The Traveling Salesman Problem (find the shortest route between a group of cities to visit them all once and return home) has a running time that is roughly proportional to the factorial of n. The running time for a program solving this problem is billions of years for an input size of 22.

Many important practical problems are intractable. Much Computer Science research is devoted to finding more efficient ways of solving these problems.