Question

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?

Answer #1

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...

Algorithm problem
2 [2.3-7] Describe a Θ(nlgn) algorithm that, given a set S of n
integers and another integer ,determines whether or not there exist
two elements in S whose sum is exactly x.

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...

Given that A to Z are mapped to integers 0-25 as follows.
A:0, B:1, C:2, D:3, E:4, F:5, G:6, H:7, I: 8, J: 9, K:10, L:11,
M:12, N:13, O:14, P:15, Q:16, R:17, S:18, T:19, U:20, V:21, W:22,
X:23, Y:24, Z:25.
Encrypt the following message using Vigenere Cipher with key:
CIPHER
THISQUIZISEASY
What is the ciphertext? Show your work.
PLEASE HELP

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 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 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...

Given the data 28.65 26.55 26.65 27.65 27.35 28.35 26.85 28.65
29.65 27.85 27.05 28.25 28.85 26.75 27.65 28.45 28.65 28.45 31.65
26.35 27.75 29.25 27.65 28.65 27.65 28.55 27.65 27.25 Determine (a)
the mean, (b) the standard deviation, (c) the variance, (d) the
coefficient of variation, and (e) the 90% confidence interval for
the mean. (f) Construct a histogram. Use a range from 26 to 32 with
increments of 0.5. (g) Assuming that the distribution Thus, the
improved estimates...

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
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...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 1 minute ago

asked 20 minutes ago

asked 32 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 2 hours ago

asked 2 hours ago

asked 2 hours ago