Algorithms and Problem Solving · Lesson 3.3.1–3.3.2
Solvable, Unsolvable, Tractable and Intractable Problems
Understand whether a general algorithm exists for a problem and distinguish feasible polynomial-growth tasks from tasks whose exact solutions can become impractical.
01
Learning objectives
Define a solvable problem and an unsolvable problem.
Explain the Halting Problem at a conceptual level.
Distinguish tractable from intractable problems.
Explain why runtime growth matters as input size increases.
Recognise that intractable problems may still have useful approximations or restricted solutions.
02
Lesson notes
A solvable problem has an algorithm that produces the required answer for every valid input and terminates after a finite number of steps. Sorting a finite list and calculating a greatest common divisor are examples. An unsolvable problem has no general algorithm that can correctly solve every possible input in the stated problem class.
The Halting Problem asks whether an arbitrary program, given an arbitrary input, will eventually stop or run forever. Alan Turing showed that no general algorithm can always decide this correctly for every program and input. This does not mean we cannot identify many ordinary programs that halt; it means there is no universal perfect decision procedure for all cases.
A tractable problem is one for which an algorithm can solve instances with a cost that grows reasonably as input size increases, commonly polynomial time. An intractable problem is one for which the known exact approaches can require resources that grow so quickly that larger instances become impractical. These are practical complexity descriptions, not claims that an individual input can never be solved.
Input size matters. An algorithm taking O(n) time grows proportionally with n; O(n²) grows much faster as n increases; exponential growth such as O(2ⁿ) can become prohibitive even for moderate input sizes. Real performance also depends on constants, hardware, memory, data structure and the actual input distribution.
For difficult problems, practical systems may use approximation algorithms, heuristics, restricted input domains or domain-specific knowledge. A solution should be clear about whether it is exact, approximate or guaranteed only for a limited class of inputs.
03
Worked code examples
Worked example
The number of checks grows linearly. This contrasts with an algorithm that explores every subset or permutation, whose search space may grow far more quickly.
def linear_work(n):
checks = 0
for _ in range(n):
checks += 1
return checks
for n in (10, 100, 1000):
print(n, "input items ->", linear_work(n), "checks")