A computational problem is a problem that can be solved by discrete computational steps specified with an Algorithm.
Formal Definition
A computational problem consists of:
- A set of instances — the valid inputs
- A set of solutions — the valid outputs
- A relation — mapping instances to their valid solutions
An Algorithm solves if for every instance , it produces an output such that .
Problem Specifications
Every computational problem is defined by three things:
- Input — the set of instances or cases that are processed as inputs
- Constraints — conditions the input must satisfy
- Output conditions — what the produced output must satisfy
Example: Sorting
- Input: a sequence of numbers
- Output: a permutation such that
- Constraints: none (works for any comparable sequence)
Types of Computational Problems
| Type | Description | Example |
|---|---|---|
| Decision | Yes/No answer | Is prime? |
| Search | Find a solution | Find shortest path |
| Optimization | Find the best solution | Minimum spanning tree |
| Counting | Count solutions | How many valid colorings? |
Related
- Algorithm — the mechanism that solves computational problems
- RAM Model of Computation — the abstract machine on which problems are solved