Trim(L, ) ; L = <y1, .., ym> sorted in non-decreasing order 1 m = 2 L' = 3 last = y1 4 for i = 2 to m 5 if last < (1 - )yi 6 then append yi on end of L' 7 last = yi 8 return L'
Approx-Subset-Sum(S, t, ) 1 n = S 2 L0 = 0 3 for i = 1 to n 4 Li = Merge-Lists( ) 5 Li = Trim(Li, ) 6 remove from Li elements > t 7 return largest value in Ln
Error passed to Trim is to prevent too much inaccuracy after repeated trimmings.
Theorem 37.6
Approx-Subset-Sum is a fully poly-time approximation scheme for the subset-sum problem.