O(n^2 * 2^n) --- Break it down: O(n) [Choices of i] * O(2^n) [choice of s] * O(n) [subproblems]

Base Case: 0 if S={1}, infinite otherwise.

Use a recurrence relation: Let us define a term C(S, i) be the cost of the minimum cost path visiting each vertex in set S exactly once, starting at 1 and ending at i. We start with all subsets of size 2 and calculate C(S, i) for all subsets where S is the subset, then we calculate C(S, i) for all subsets S of size 3 and so on.

Return min A[{1,2,3.}, j ] +C sub ji

OPT(j)= max { v j + OPT( p( j)), OPT( j -1)} fft(n, a0,a1,...,an-1) {

if (n == 1) return a0

(e0,e1,...,en/2-1) & FFT(n/2, a0,a2,a4,...,an-2)

(d0,d1,...,dn/2-1) & FFT(n/2, a1,a3,a5,...,an-1)

for k = 0 to n/2 - 1 {

"k & e2$ik/n

yk+n/2 & ek + "k dk

yk+n/2 & ek - "k dk

}

return ;