Question

2. There is a famous problem in computation called Subset Sum: Given a set S of...

2. There is a famous problem in computation called Subset Sum: Given a set S of n integers S = {a1, a2, a3, · · · , an} and a target value T, is it possible to find a subset of S that adds up to T? Consider the following example: S = {−17, −11, 22, 59} and the target is T = 65. (a) What are all the possible subsets I can make with S = {−17, −11, 22, 59}? What is the sum of each subset? Hint 1: Choosing no numbers is an option to get a sum of 0. Hint 2: Refer to exercise 4 (Knapsack problem) in the lecture notes. (b) How many subsets are possible with S? (c) Is there a subset of S that sums up to our target T = 65? (d) If I give you a set of 5 integers, how many possible subsets do I need to check? What if I give you n integers?

Homework Answers

Know the answer?
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
Similar Questions
In this problem, we will explore how the cardinality of a subset S ⊆ X relates...
In this problem, we will explore how the cardinality of a subset S ⊆ X relates to the cardinality of a finite set X. (i) Explain why |S| ≤ |X| for every subset S ⊆ X when |X| = 1. (ii) Assume we know that if S ⊆ hni, then |S| ≤ n. Explain why we can show that if T ⊆ hn+ 1i, then |T| ≤ n + 1. (iii) Explain why parts (i) and (ii) imply that for...
Let S denote the set of all possible finite binary strings, i.e. strings of finite length...
Let S denote the set of all possible finite binary strings, i.e. strings of finite length made up of only 0s and 1s, and no other characters. E.g., 010100100001 is a finite binary string but 100ff101 is not because it contains characters other than 0, 1. a. Give an informal proof arguing why this set should be countable. Even though the language of your proof can be informal, it must clearly explain the reasons why you think the set should...
Compute each of the following probabilities. Label each problem clearly and show all your work. Use...
Compute each of the following probabilities. Label each problem clearly and show all your work. Use the numbers you computed in earlier parts of the project based on the class data set. Problem 1: Suppose all of the Skittles in the class data set are combined into one large bowl and you are going to randomly select one Skittle. (a) What is the probability that you select a green Skittle? (4 points) (b) What is the probability that you select...
Pinky and The Brain are great friends. They like to play games with numbers. This time,...
Pinky and The Brain are great friends. They like to play games with numbers. This time, Pinky has given The Brain a list of numbers and given him the task of determining if it is possible to choose a subset of them such that they sum is equal to another given number. Build an algorithm using dynamic programming to help The Brain with his problem. INPUT The first line corresponds to N, the amount of numbers given by Pinky The...
Do the following problems. 1. Each of three barrels from a manufacturing line are classified as...
Do the following problems. 1. Each of three barrels from a manufacturing line are classified as either above (a) or below (b) the target weight. Provide the ordered sample space. 2. The heat on each of two soldered parts is measured and labeled as either low (l), medium (m), or high (h). State the number of elements in the ordered sample space. 3. Consider the set of Beatles songs with a primary writer as either Paul McCartney (P) or John...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import java.io.*; //This imports input and output (io) classes that we use 3 //to read and write to files. The * is the wildcard that will 4 //make all of the io classes available if I need them 5 //It saves me from having to import each io class separately. 6 /** 7 This program reads numbers from a file, calculates the 8 mean (average)...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as possible: What is a checked exception, and what is an unchecked exception? What is NullPointerException? Which of the following statements (if any) will throw an exception? If no exception is thrown, what is the output? 1: System.out.println( 1 / 0 ); 2: System.out.println( 1.0 / 0 ); Point out the problem in the following code. Does the code throw any exceptions? 1: long value...
** Note ** Execute the following query before completing steps 1 and 2: INSERT INTO Employees...
** Note ** Execute the following query before completing steps 1 and 2: INSERT INTO Employees (LastName, FirstName, BirthDate, Notes) VALUES ('Smith','Mary','1980-10-15','John is a student at Nashville State.'); 1. Using the record you just created in the Note above, write a query to update the LastName field to Jones. 2. Using the record you just created in the Note above, write a query to delete that record. 3. Write a query using the Products table that will return the sum...
1) Describe an example of each of the following that may be found of your kitchen:...
1) Describe an example of each of the following that may be found of your kitchen: Explain how your choice falls into this category, and if there is a chemical name or symbol for it, provide that as well. Provide a photo of your example with your ID card in it. a) a compound b) a heterogeneous mixture c) an element (symbol) Moving to the Caves… Lechuguilla Caves specifically. Check out this picture of crystals of gypsum left behind in...
Your company has been granted an exclusive license to sell ice cream. No one has ever...
Your company has been granted an exclusive license to sell ice cream. No one has ever sold ice cream here before, so you have no idea what the demand will look like. You suspect that people like to buy more ice cream on hotter days, but you are very unsure about what price you should charge to maximize your profit. Over your first season selling ice cream, you vary your price each week for the 10 weeks your license allows...