A problem is tractable if it can be solved in polynomial time — i.e. there exists an algorithm with time complexity O(nᵏ) for some constant k. Tractable problems are considered practically solvable for large inputs.
A problem is intractable if no polynomial-time algorithm is known — the best known algorithms are super-polynomial (e.g. exponential or factorial). Intractable problems are considered practically unsolvable for large inputs.
| Problem | Complexity | Notes |
|---|---|---|
| Travelling Salesman Problem (TSP) | O(n!) brute force | Finding shortest route visiting all cities once |
| Knapsack problem | O(2ⁿ) brute force | Selecting items to maximise value within weight limit |
| Boolean satisfiability (SAT) | O(2ⁿ) worst case | Can a set of boolean clauses all be true simultaneously? |
| Graph colouring | Exponential (general) | Minimum colours to colour a graph so no adjacent same |
P — the class of problems solvable in polynomial time by a deterministic computer.
NP — the class of problems where a solution can be verified in polynomial time. (NP stands for Non-deterministic Polynomial time.)
The Halting Problem asks: Given any program P and any input I, will P eventually halt (terminate) or loop forever?
Alan Turing proved in 1936 that no general algorithm can solve the Halting Problem — it is undecidable.
// Suppose a program H(P, I) exists that returns: // true → P(I) halts // false → P(I) loops forever // Construct a program D(P) that: // if H(P, P) = true → D loops forever // if H(P, P) = false → D halts // Now run D(D): // If H(D, D) = true → D(D) should halt, but D loops → contradiction! // If H(D, D) = false → D(D) should loop, but D halts → contradiction! // Therefore H cannot exist.
8 questions · instantly marked · AQA 7517 standard
| Term | Definition |
|---|
10 questions · 10 minutes