◑ GROWING NOTE algorithmscs-fundamentals
Computational Problem
A problem that can be solved by discrete computational steps specified with an algorithm.
PLANTED · 29 DECEMBER 2025 · ZETTEL NOTE
A computational problem is a problem that can be solved by discrete computational steps specified with an Algorithm.
A computational problem P consists of:
- A set of instances I — the valid inputs
- A set of solutions O — the valid outputs
- A relation R⊆I×O — mapping instances to their valid solutions
An Algorithm A solves P if for every instance i∈I, it produces an output o∈O such that (i,o)∈R.
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 n numbers ⟨a1,a2,…,an⟩
- Output: a permutation ⟨a1′,a2′,…,an′⟩ such that a1′≤a2′≤…≤an′
- Constraints: none (works for any comparable sequence)
Types of Computational Problems
| Type | Description | Example |
|---|
| Decision | Yes/No answer | Is n prime? |
| Search | Find a solution | Find shortest path |
| Optimization | Find the best solution | Minimum spanning tree |
| Counting | Count solutions | How many valid colorings? |