Skip to main content
EnglandComputer ScienceSyllabus dot point

How are problems and algorithms classified by how hard they are to solve?

Understand tractable and intractable problems, the classes P and NP, the idea of computable and non-computable problems, and the use of heuristics for intractable problems.

A focused answer to AQA A-Level Computer Science 4.4.6 and 4.4.7, covering tractable and intractable problems, the classes P and NP, computable and non-computable problems, and the use of heuristics to tackle intractable problems.

Generated by Claude Opus 4.88 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. Tractable and intractable problems
  3. P and NP
  4. Computable problems and heuristics

What this dot point is asking

AQA wants you to classify problems as tractable or intractable, explain the classes P and NP, distinguish computable from non-computable problems, and explain why heuristics are used for intractable problems.

Tractable and intractable problems

The travelling salesperson problem (visiting every city by the shortest route) is the classic intractable example. The reason intractability bites is the explosive growth of these functions: an O(2n)O(2^n) algorithm that handles 30 items in seconds would take longer than the age of the universe for a few hundred, so no faster hardware can rescue it. This directly builds on the orders of growth from Big-O complexity, where the gap between polynomial and exponential growth is first quantified.

P and NP

The distinction between solving and verifying is the heart of P versus NP. Many important problems are easy to check but seem hard to solve: given a proposed route for the travelling salesperson, you can quickly add up its length and check it is under a limit (verification), yet finding the shortest route in the first place appears to need exponential effort (solution). If it turned out that P equals NP, every such quickly-checkable problem would also be quickly solvable, which would transform fields from cryptography to logistics, and is why the question is so significant.

Computable problems and heuristics

It is important to keep three categories separate. Non-computable problems cannot be solved by any algorithm ever (the halting problem, decided by Turing). Intractable problems can be solved but not quickly for large inputs. Tractable problems can be solved quickly. Heuristics are the pragmatic response to the middle category: rather than abandon an intractable problem, we settle for a fast approximation that is usually close to optimal, which is why real satnavs and timetabling systems use heuristics rather than exhaustive search.

Exam-style practice questions

Practice questions written in the style of AQA exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

AQA 20194 marksExplain the difference between a tractable and an intractable problem, and explain why a heuristic might be used to tackle an intractable problem such as the travelling salesperson problem.
Show worked answer →

A tractable problem can be solved by an algorithm that runs in polynomial time, such as O(n)O(n) or O(n2)O(n^2), so it remains practical even for large inputs. An intractable problem has a solution in theory but no known polynomial-time algorithm; the best-known algorithms grow far faster (for example O(2n)O(2^n) or O(n!)O(n!)), so the running time becomes impossibly long as the input grows.

The travelling salesperson problem (finding the shortest route visiting every city) is intractable, so for many cities an exact solution cannot be found in reasonable time. A heuristic is used instead: a rule-of-thumb method (such as always going to the nearest unvisited city) that finds a good-enough, near-optimal route quickly, accepting that it may not be the absolute best.

Markers reward the polynomial versus no-known-polynomial distinction and explaining that a heuristic trades guaranteed optimality for a fast, good-enough answer.

AQA 20214 marksExplain the difference between an intractable problem and a non-computable problem, and describe the relationship between the complexity classes P and NP.
Show worked answer →

An intractable problem is solvable in principle but has no known algorithm that runs in reasonable (polynomial) time, so it is impractical for large inputs. A non-computable problem has no algorithmic solution at all, regardless of how much time is available; the halting problem is the classic example. The key difference is that an intractable problem can be solved (just too slowly), whereas a non-computable one can never be solved by any algorithm.

Class P is the set of problems that can be solved in polynomial time. Class NP is the set of problems whose proposed solution can be verified in polynomial time. Every problem in P is also in NP (if you can solve it quickly you can check it quickly). Whether P equals NP, that is whether every quickly-checkable problem is also quickly solvable, is a famous open question.

Markers reward the solvable-but-slow versus no-algorithm distinction and a correct account of P (solvable in polynomial time) and NP (verifiable in polynomial time) with P being a subset of NP.

Related dot points

Sources & how we know this