OCR H446, section 2.2.2 (a)
Not every problem can be solved by a computer. A problem is solvable by computational methods when it has certain features.
Features of a computable problem
| Feature | Meaning | Example |
|---|---|---|
| Clearly defined | The problem and a correct answer can be stated precisely | "Find the shortest route between two towns" |
| Inputs and outputs can be defined | You can say what goes in and what must come out (2.1.2 (a)) | A list of numbers in, the sorted list out |
| Can be represented as data | The real situation can be abstracted into numbers, text or structures (2.1.1) | A road map as a graph |
| Has rules or steps that can be followed | There's an algorithm: a finite sequence of unambiguous steps | Long multiplication |
| Finite | The algorithm ends after a finite number of steps | A search through a list |
| Practical to run | It can be done in a reasonable time with the memory available | Sorting a million records |
| Can be broken down | It can be split into smaller, simpler problems (2.2.2 (c)) | Making a booking system from many small parts |
| Is decidable | A correct answer can be determined, at least in principle | "Is this number prime?" |
Features that make a problem hard or unsuitable
- Vague or subjective: "Write the best song" has no precise definition of "best".
- No clear rules: judgements that depend on opinion or emotion.
- Missing or unreliable data: you can't compute from information you don't have.
- Too large or too slow (intractable): solvable in theory but not in practice. The number of steps grows so fast that the problem takes longer than the age of the universe for realistic inputs. Examples include the travelling salesman problem with many cities (found by trying every route, see 2.3.1 (c) and heuristics, 2.2.2 (f)).
- Unsolvable (non-computable): no algorithm can exist. The classic example is the halting problem: no program can work out, for every program and input, whether it will finish or run forever.
| Type | Meaning | Example |
|---|---|---|
| Solvable and tractable | Algorithm exists and runs in reasonable time | Sorting, searching |
| Solvable but intractable | Algorithm exists but takes impractically long | Checking every route for 60 cities |
| Unsolvable | No algorithm exists | The halting problem |
Problems that suit computers
Computers are best at problems that involve:
- Repetitive tasks, which need the same steps many times.
- Large amounts of data to process.
- Fast, accurate calculation.
- Following precise rules without tiring or making mistakes.
- Tasks where speed matters.
People are better at judgement, creativity and understanding context.
Applying it
To check whether a problem is suitable, ask:
- Can I state it exactly, with a clear idea of a correct answer?
- Can I describe the inputs and outputs?
- Can the real situation be modelled as data?
- Can I describe a finite series of steps that gives the answer?
- Would the steps finish in a reasonable time?
- Can it be split into parts?
If the answer to any is "no", the problem may need to be redefined, simplified (abstraction), or solved approximately (heuristics).
Worked example
Task: decide whether each problem is suitable for a computational solution.
| Problem | Suitable? | Reason |
|---|---|---|
| Work out the VAT on a list of prices | Yes | Clear rule, definable inputs and outputs, finite |
| Find which student has the highest mark | Yes | Precise, finite (one pass through the data) |
| Decide which painting is the most beautiful | No | Subjective: no precise definition of correct |
| Find the best route through 50 towns, visiting each once | Partly | An algorithm exists (try every route), but there are about routes, which is far too many to check, so a heuristic gives a good but not guaranteed best answer |
| Check whether any program will stop | No | Proven unsolvable (the halting problem) |
Exam tip: for this point, give features with reasons, such as "the problem has clear inputs and outputs, so a program can be written to process them". To explain why a problem can't be solved, distinguish unsolvable (no algorithm), intractable (takes too long) and vague (can't be defined).
Check yourself
Give three features of a problem that make it solvable by computational methods
Any three of: clearly defined; definable inputs and outputs; can be represented as data; has precise rules or steps; finite; practical to run in reasonable time; can be broken into parts.
Why is "write the best poem" unsuitable for a computer?
It is subjective and has no precise definition of what a correct answer is, so there are no rules to follow.
What does it mean for a problem to be intractable?
An algorithm exists, but it takes so long to run for realistic inputs that it isn't practical.
Give an example of a problem that is unsolvable by any algorithm
The halting problem: deciding whether any given program will eventually stop.