5.2 Limits of Computing: Unsolvable Problems, Intractability, and Heuristics

Key Takeaways

  • Alan Turing proved in 1936 that no algorithm can decide, for every program and input, whether the program will eventually halt; this is the halting problem.
  • A problem is undecidable when no algorithm can solve every instance; it is intractable when an algorithm exists but needs impractically much time or memory as inputs grow.
  • A heuristic is a rule of thumb that finds a good solution quickly but does not guarantee the best, or any, correct solution.
  • Heuristics are useful when an exact method is too slow, when a good-enough answer is acceptable, or when a decision must be made in real time.
  • At one billion operations per second, 2⁶⁰ steps take about 36.5 years, which shows why exponential algorithms fail for even moderate n.
Last updated: September 2026

What this competency asks

ETS asks you to be familiar with the limitations of computing in terms of time, space, and solvability, as well as with the use of heuristic solutions that can address these limitations. Beyond identifying linear, quadratic, exponential, and logarithmic growth (Section 5.1), you should be able to:

  • Recognize the existence of problems that cannot be solved by a computer.
  • In context, identify the factors that prevent a problem from being solvable.
  • Identify situations where heuristic solutions are useful.
  • In context, identify space and time limitations of computational solutions.

Problems no computer can solve

A problem is decidable if some algorithm always produces a correct yes-or-no answer in finite time for every input. A problem is undecidable if no such algorithm can exist, no matter how fast the computer or how clever the programmer.

The halting problem

The best-known undecidable problem is the halting problem: given any program and any input, determine whether the program will eventually stop or run forever. Alan Turing proved in 1936 that no algorithm can solve it for all programs.

The intuition is a proof by contradiction:

  1. Suppose a procedure halts ( program, input ) always correctly answers true or false.
  2. Build a new program trouble ( p ) that calls halts ( p, p ). If the answer is true, trouble loops forever. If the answer is false, trouble stops.
  3. Now ask what happens when you run trouble ( trouble ). If halts says it halts, it loops forever. If halts says it loops forever, it halts. Either way halts is wrong.
  4. So the assumed procedure cannot exist.

Practical consequences follow. No tool can examine every possible program and correctly report whether it contains an infinite loop, whether two programs always produce the same output, or whether a program will ever print a particular message. Tools can check many specific cases or give warnings, but not a guaranteed answer for all programs.

This does not mean you can never tell whether a particular loop ends. For for ( int i ← 0; i < 10; i ← i + 1 ) you obviously can. The limit is on a single algorithm that works for every program.

Problems that are solvable but impractical

A problem is intractable when algorithms exist but all known ones need so much time or memory that realistic inputs are out of reach.

n2ⁿ stepsn! stepsTime for n! at 10⁹ steps per second
101,0243,628,800about 0.004 seconds
20about 1 millionabout 2.4 × 10¹⁸about 77 years
60about 1.15 × 10¹⁸about 8.3 × 10⁸¹far longer than the age of the universe

Even the "better" exponential column fails quickly. At a billion steps per second, 2⁶⁰ steps take about 36.5 years. Faster hardware helps only a little. Doubling computer speed lets an O(2ⁿ) algorithm handle just one more item in the same time.

Well-known hard problems include finding the shortest route that visits every city once (the traveling salesperson problem), building the best school timetable, and packing items optimally into limited space. For these, no efficient exact algorithm is known.

Space limits

Memory can run out before time does. A table of distances between 1,000,000 locations would need 10¹² entries. At 4 bytes each, that is about 4 terabytes. Storing every possible chess position is impossible for the same reason. When a question describes a solution that stores every combination, or tries every possibility, check both time and space.

Factors that prevent a problem from being solvable

When a stem asks why a problem cannot be solved by a computer, sort the reason into one of these categories:

FactorExplanationExample
UndecidableNo algorithm can existDeciding whether any given program halts
IntractableAn algorithm exists but needs too much time or memory at the required sizeChecking every ordering of 60 delivery stops
Not well definedThe goal cannot be stated precisely enough for an algorithm"Write the best possible song"
Missing or unavailable dataThe needed inputs are not known or cannot be measuredPredicting a specific person's future choices
Resource constraintsAvailable hardware, storage, or time is too small for the inputAnalyzing a video library too large for available storage

Heuristics: good enough, fast enough

A heuristic is a problem-solving strategy that finds a reasonable answer quickly by using a rule of thumb, but gives no guarantee that the answer is optimal. Sometimes it gives no guarantee of any correct answer at all.

HeuristicHow it worksTrade-off
Nearest neighbor for routingAlways drive to the closest unvisited stop nextFast; routes are usually decent but seldom optimal
Greedy choiceTake the locally best option at each stepCan miss the global best
Game-playing evaluationScore positions with a rule of thumb (material, mobility) instead of searching to the end of the gameStrong play, no guarantee of perfect play
Spam and malware filtersFlag messages or files with suspicious featuresOccasional false positives and false negatives
Search rankingOrder results with estimated relevance signalsUseful results without a provably "best" order

A greedy heuristic that fails

To make 6 cents from coins worth 1, 3, and 4 cents, a greedy rule ("always take the largest coin that fits") picks 4 + 1 + 1, which is three coins. The optimal answer is 3 + 3, two coins. With U.S. coin values the same greedy rule happens to be optimal, which shows that a heuristic's quality depends on the problem.

When is a heuristic the right choice?

  • The exact solution is intractable for the input size, as with large routing and scheduling problems.
  • A good-enough answer is acceptable. A delivery route 3% longer than the best one is fine if it can be found in seconds.
  • Decisions are needed in real time, as with navigation apps, games, and robotics.
  • The problem is poorly defined or the data are noisy, so exact optimality is not meaningful anyway.

A heuristic is a poor choice when a guaranteed correct or optimal answer is essential and an efficient exact algorithm exists, for example sorting grades or computing a bank balance.

Test Your Knowledge

A teacher wants a program that can examine any student's program, with any input, and always report correctly whether the student's program will eventually stop. Which statement is accurate?

A
B
C
D
Test Your Knowledge

A delivery company must plan routes each morning through about 200 stops, and a route that is a few percent longer than the best possible route is acceptable. Which approach is most appropriate?

A
B
C
D
Test Your Knowledge

An algorithm must examine 2⁶⁰ possibilities, and a computer checks one billion (10⁹) possibilities per second. Approximately how long will the computer take?

A
B
C
D