Subset-sum problem is in NP

programming

Statement

Lemma

Proof

It is of the format to be a search problem as it either returns a result or it says no such result exists.

Suppose we are given an instance $a_i$ for $1 \leq i \leq n$ and $t$. To verify a solution $S \subset \{1, \ldots, n\}$ make the check

$$ \sum_{i \in S} a_i = t $$

this takes $O(n\log(t))$ time. Therefore this takes polynomial time.