Question

In this assignment, you will prove that the Zero Sum problem is NP-Complete. The Zero Sum...

In this assignment, you will prove that the Zero Sum problem is NP-Complete. The Zero Sum problem accepts an array of n integers and returns whether it is possible to negate some of those integers to make the array sum equal 0. For example, the array data = [1, 3, 5, 7, 9, 11] has a zero sum if you negate the 7 and 11, while the array data = [1, 2, 5, 9, 13, 22] cannot be reduced to a sum of zero.

1. Prove that Zero Sum is NP.

2. The Subset Sum problem is NPC. This takes in an array of n integers and a target t to determine if the array has a subset that sums to t. To prove that Zero Sum is NPC, would you reduce Zero Sum to Subset or Subset Sum to Zero Sum?

3. Give pseudocode for a reduction in the appropriate direction. NOTE: This answer is based on the CORRECT answer for #2. Subset Sum has two parameters (an array and a target value) while Zero Sum only has one (an array). If you are reducing ZS to SS, you will need to come up with a target value and possibly modify the array. If you are reducing SS to ZS, you will need to come up with an array that incorporates the target value.

4. Show that your reduction is polynomial time

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. To show that Zero Sum is NP we need to show that we can verify a certificate of Zero Sum in polynomial time.
This can be done easily, as we can take the indices of the elements of the array which need to be negated as our certificate. Now, to verify if the certificate is correct, we just need to find the sum of the elements of the array after negating the elements in the corresponding indices of the array and return True if the sum is 0 or False otherwise.

2. We need to reduce Subset Sum to Zero Sum in polynomial time to prove that Zero Sum is NP complete.

3. Let S be an array and t be a target value. We need to find a reduction f such that f(S) will be in Zero Sum if and only if <S,t> is in Subset Sum. In other words, we find an array negating sum of whose elements and taking the sum of all the elements will give 0 if and only if there is a subset of S whose sum of elements is t.

We can form the power set of the given array S, and append the element -t to each of the elements in the power set. We now need to find if any of the elements of the power set belongs to Zero Sum.

4. Though the number of elements in the power set of S is , the power set can be formed in polynomial time. So, the reduction is polynomial.

Add a comment
Know the answer?
Add Answer to:
In this assignment, you will prove that the Zero Sum problem is NP-Complete. The Zero Sum...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Problem 2. In the Subset-Sum problem the input consists of a set of positive integers X...

    Problem 2. In the Subset-Sum problem the input consists of a set of positive integers X = {x1, . . . , xn}, and some integer k. The answer is YES if and only if there exists some subset of X that sums to k. In the Bipartition problem the input consists of a set of positive integers Y = {y1, . . . , yn}. The answer is YES if and only if there exists some subset of X...

  • Is the following problem NP-Complete? The Rice bowl problem is to pick the ingredients for your bowl. You are given a se...

    Is the following problem NP-Complete? The Rice bowl problem is to pick the ingredients for your bowl. You are given a set of ingredients I1 to In. Each ingredient Ii comes with a quality qi and a quantity si . You are also given a bowl size S and a quality goal Q. Can you select a subset of the ingredients that both fit in the bowl (the sum of their si is at most S) and have enough quality...

  • NP complete problem: Big project problem. To finish the big project, you need to finish X...

    NP complete problem: Big project problem. To finish the big project, you need to finish X requirements. However, you only have time to write B < X more classes. Luckily, a single class can satisfy many requirements. Input are list of requirements and list of classes that satisfy each requirement. a/ Show that the problem is in NP b/ Show that the problem is in NP-complete by reduction

  • In this problem, your goal is to identify who among a group of people has a...

    In this problem, your goal is to identify who among a group of people has a certain disease. You collect a blood sample from each of the people in the group, and label them 1 through n. Suppose that you know in advance that exactly one person is infected with the disease, and you must identify who that person is by performing blood tests. In a single blood test, you can specify any subset of the samples, combine a drop...

  • please use c++ programming and single dimensional arrays to solve this problem thank you Problem 02:...

    please use c++ programming and single dimensional arrays to solve this problem thank you Problem 02: Large Integer (20 points) In CH, the largest int value is 2147483647. So, an integer larger than this cannot be stored and processed as an integer. Similarly, if the sum or product of two positive integers is greater than 2147483647, the result will be incorrect. One way to store and manipulate large integers is to store each individual digit of the number in an...

  • Answer all parts of the problem given in the .jpeg file below: The impatient mover problem...

    Answer all parts of the problem given in the .jpeg file below: The impatient mover problem accepts an array of n positive integers, represent- ing the weights of boxes in an apartment and returns the maximum number of boxes that can be picked up in one pass through the apartment, given that you mav not select a box that is heavier than a box that has been chosen before it. For example, if the boxes were 29, 20, 30, 18,...

  • The purpose of this lab is to manipulate an array of integers. The assignment is to...

    The purpose of this lab is to manipulate an array of integers. The assignment is to write a program that: 1. Declares an array of integers of some maximum size 20. 2. Implements the following functions: ü A function that prompts the user to initialize the array with up to 20 non-negative whole numbers and mark the end of the input with a negative number. The entire array does not need to be initialized. The user may enter only as...

  • This is a C++ assignment that I'm trying to create and would like some help understanding...

    This is a C++ assignment that I'm trying to create and would like some help understanding while loops, with possible integration of for loops and if statements. This program only uses while, for, and if. I have some code that I have started, but where to go from there is what's giving me some trouble. This is involves a sentinel controlled while loop, and there are a lot of specifications below that I must have in the program. The program...

  • This is a C++ assignment that I'm trying to create and would like some help understanding...

    This is a C++ assignment that I'm trying to create and would like some help understanding while loops, with possible integration of for loops and if statements. This program only uses while, for, and if. I have some code that I have started, but where to go from there is what's giving me some trouble. This is involves a sentinel controlled while loop, and there are a lot of specifications below that I must have in the program. The program...

  • Write an assembly language program to do the following, and run it and test it on...

    Write an assembly language program to do the following, and run it and test it on the lab simulator: Read in integers until a zero is read in. Keep a total of both the quantity and the sum of the negative integers and the positive integers. Once a zero is read in (signifying the end of the input) then: • If there were more positive than negative integers, or an equal number, print out a 0 and the sum of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT