AQA 7517, section 4.4.4.4
Computers are powerful, but they aren't magic. There are limits to what they can do. Algorithmic complexity and hardware both place limits on what can be computed in practice.
Limits set by algorithmic complexity
Some problems can be solved by an algorithm, but the best known algorithm grows so quickly that the answer can't be found in any reasonable time, even for fairly small inputs.
Suppose a computer performs one billion () steps per second. How long does an algorithm with each complexity take?
| 20 | instant | instant | about 1 millisecond |
| 50 | instant | instant | about 13 days |
| 100 | instant | instant | about years |
For , an exponential algorithm would take longer than a thousand times the age of the universe (about years). Making the computer 1 000 times faster would barely help: it would still be hopelessly long.
This means no amount of ordinary hardware improvement can make an exponential-time algorithm practical for large inputs. Doubling the input size can square the work.
Example: brute-force password cracking
Trying every possible password of length from 95 printable characters takes about attempts. Every extra character multiplies the time by 95. This is why longer passwords are so much more secure, and why encryption depends on the fact that some problems (such as factorising very large numbers) have no known quick method.
Limits set by hardware
Even for efficient algorithms, a real computer has limits:
- Processor speed: only so many instructions per second.
- Memory: only so much data fits, so a very large problem may need more space than exists.
- Storage and data transfer speed: moving data in and out takes time.
- Power and heat: faster chips use more energy and produce more heat, which limits how fast a processor can run.
- Physical limits: components can only be made so small, and signals can't travel faster than the speed of light.
More hardware (many processors working in parallel) helps with some problems, but not with those where the steps must be done in order, and not enough for exponential growth.
What do we do about it?
When a problem is too hard to solve exactly in a reasonable time, we can:
- use a faster algorithm, if one exists;
- use a heuristic, which gives a good answer, though perhaps not the best, quickly (see 4.4.4.5);
- reduce the size of the problem, or accept an approximate answer;
- use more hardware, where the problem can be split up.
Worked example
Task: a program finds the shortest route visiting cities by trying every order. A computer checks one billion routes per second. Estimate the time for and .
The number of orders is .
- routes. At per second this takes about 1 300 seconds, around 22 minutes.
- routes. At per second, that is about seconds, around 77 years.
Adding just five cities changes the time from minutes to decades. A computer 100 times faster would still need nearly a year. The limits of algorithmic complexity, not of hardware, are the problem here.
Exam tip: give both causes. Complexity limits what can be computed because some algorithms take an impractical time as grows, and hardware limits (speed, memory) mean even efficient algorithms can't handle unlimited amounts of data.
Check yourself
Why can't faster computers solve every problem?
For problems with exponential (or worse) complexity, the time needed grows so quickly with input size that even a much faster computer still can't solve large cases in a reasonable time.
Give two hardware limits on computation
Any two of: processor speed; amount of memory; storage and data transfer speed; power and heat; physical limits on the size of components.
What can be done when a problem is too hard to solve exactly?
Use a heuristic to find a good (but not guaranteed best) answer, find a faster algorithm if one exists, reduce the problem size, accept an approximation or use more hardware.