next up previous
Next: Up: Previous:

Decision Problems and Algorithms

*
An algorithm A accepts a string x $\in$ {0,1}* if, given input x, the algorithm outputs A(x) = 1
*
The language accepted by an algorithm A is the set L = {x $\in$ {0,1}* $\mid$ A(x) = 1}
*
An algorithm A rejects a string x if A(x) = 0
*
A language L is decided by an algorithm A if every binary string is either accepted or rejected by the algorithm.



Example

The language PATH is decided by the following algorithm in polynomial time:

$\;\;\;\;\;$Use Bellman-Ford to find shortest path from u to v in G
$\;\;\;\;\;$If length(path) $\leq$ k
$\;\;\;\;\;$then output 1
$\;\;\;\;\;$else output 0


next up previous
Next: Up: Previous: