Computational Problem

A problem that can be solved by discrete computational steps specified with an algorithm.

A computational problem is a problem that can be solved by discrete computational steps specified with an Algorithm.

Formal Definition

A computational problem PP consists of:

  • A set of instances II — the valid inputs
  • A set of solutions OO — the valid outputs
  • A relation RI×OR \subseteq I \times O — mapping instances to their valid solutions

An Algorithm AA solves PP if for every instance iIi \in I, it produces an output oOo \in O such that (i,o)R(i, o) \in R.

Problem Specifications

Every computational problem is defined by three things:

  1. Input — the set of instances or cases that are processed as inputs
  2. Constraints — conditions the input must satisfy
  3. Output conditions — what the produced output must satisfy

Example: Sorting

  • Input: a sequence of nn numbers a1,a2,,an\langle a_1, a_2, \ldots, a_n \rangle
  • Output: a permutation a1,a2,,an\langle a_1', a_2', \ldots, a_n' \rangle such that a1a2ana_1' \leq a_2' \leq \ldots \leq a_n'
  • Constraints: none (works for any comparable sequence)

Types of Computational Problems

TypeDescriptionExample
DecisionYes/No answerIs nn prime?
SearchFind a solutionFind shortest path
OptimizationFind the best solutionMinimum spanning tree
CountingCount solutionsHow many valid colorings?