# Transcribed Image Text: Consider the following problem: for a given set of integers, is there a subset of these integers with a sum

Transcribed Image Text: Consider the following problem: for a given set of integers, is there a subset of these integers with a sum

that exceeds a given value?

Does the following algorithm show that this problem is in NP? Why or why not? For full credit, explain

exactly what the algorithm does.

// Input: S, a set of integers

// Input: k, an integer

// Output: True if the sum of the values of some subset of S exceeds k

//

False otherwise

CheckLargestSum( S, k)

oracleMax – 0

for each x in S do

shouldInclude –

oracle( x)

if shouldInclude

oracleMax = oracleMax + x

if oracleMax > k

return True

else

return False

-25-