Given a set S of integers, an integer total, and a non-negative integer budget, the SubsetSum...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Given a set S of integers, an integer total, and a non-negative integer budget, the SubsetSum Decision problem is to report whether or not there is a subset of S, containing at most budget elements, that sums to total. Given a set 5 of integers, an integer total, and a non-negative integer budget, the SubsetSumSearch problem is to find a subset of S, containing at most budget elements, that sums to total or to report that no such set exists. A) Suppose you have a polynomial time algorithm called SSD that solves the SubsetSum Decision problem. Describe, in clear and concise English, a polynomial time algorithm called SSS that solves the SubsetSumSearch problem. (Hint: SSS should call SSD multiple times.) You should not need more than five sentences or so. B) Suppose S is a set containing in integers, and that SSD/S, total, budget) is Off(n)). What of these is the tightest upper bound on the running time of SSS(S, total, budget)? a. O(n f(n)) b. O(f(n)^2) c. O(f(n) log n) d. O(f(n^2)) QUESTION 2 a) Define Primitive data type. b) List TWO (2) types of Recursive cases. c) State TWO (2) disadvantages of an array list. d) Give ONE (1) difference between Perfect binary tree and Full binary tree. e) State the output from a method public void pop () in Stack. f) List ONE (1) example of non-linear data structure. g) Define Tail recursive. (2 marks) (2 marks) (2 marks) (2 marks) (2 marks) (2 marks) (2 marks) Given a set S of integers, an integer total, and a non-negative integer budget, the SubsetSum Decision problem is to report whether or not there is a subset of S, containing at most budget elements, that sums to total. Given a set 5 of integers, an integer total, and a non-negative integer budget, the SubsetSumSearch problem is to find a subset of S, containing at most budget elements, that sums to total or to report that no such set exists. A) Suppose you have a polynomial time algorithm called SSD that solves the SubsetSum Decision problem. Describe, in clear and concise English, a polynomial time algorithm called SSS that solves the SubsetSumSearch problem. (Hint: SSS should call SSD multiple times.) You should not need more than five sentences or so. B) Suppose S is a set containing in integers, and that SSD/S, total, budget) is Off(n)). What of these is the tightest upper bound on the running time of SSS(S, total, budget)? a. O(n f(n)) b. O(f(n)^2) c. O(f(n) log n) d. O(f(n^2)) QUESTION 2 a) Define Primitive data type. b) List TWO (2) types of Recursive cases. c) State TWO (2) disadvantages of an array list. d) Give ONE (1) difference between Perfect binary tree and Full binary tree. e) State the output from a method public void pop () in Stack. f) List ONE (1) example of non-linear data structure. g) Define Tail recursive. (2 marks) (2 marks) (2 marks) (2 marks) (2 marks) (2 marks) (2 marks)
Expert Answer:
Related Book For
Data Structures and Algorithms in Java
ISBN: 978-1118771334
6th edition
Authors: Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
Posted Date:
Students also viewed these computer network questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
The following is a sufficient condition, the Laplace-Liapounoff condition, for the central limit theorem: If X 1 , X 2 , X 3 , . . . is a sequence of independent random variables, each having an...
-
A tennis ball, starting from rest, rolls down the hill in the drawing. At the end of the hill the ball becomes airborne, leaving at an angle of 35 with respect to the ground. Treat the ball as a...
-
Relativity might seem far removed from daily life, but even some older technologies had to take it into account. The electrons that draw the picture on the screen in an old-fashioned television set...
-
Twenty-two Argentinians initiated a lawsuit against DaimlerChrysler Aktiengesellschaft (DCAG). In its complaint, the plaintiffs stated that a subsidiary of DCAG, Mercedes-Benz Argentina (MBA),...
-
Waterworld Company leased equipment from Costner Company. The lease term is 4 years and requires equal rental payments of $43,019 at the beginning of each year. The equipment has a fair value at the...
-
The amount of realized gain to be recognized in a tax year is equal to the gross profit multiplied by the ratio of payments received in the current year divided by the total contract price. ...
-
It is recorded that the average time spent in watching noontime tv shows is 3 hours. After the shutdown of a giant tv broadcasting company, many are claiming that there is a decrease of noontime...
-
Google developed a cross-compiler from Java to JavaScript. Why did they do this? Does this mean that JavaScript is not good enought for developing advanced web apps? What cultural phenomenon occurred...
-
Discuss and explain investment analysis. Provide an example for a conservative investment and a high risk investment.
-
Calculate annual NOI for a 40,000 sq. Ft. Warehouse that rents for $0.35 per sq. ft./mo. Vacancies and collection losses are 7%. The property insurance cost is $0.11 per sq. ft./year, maintenance...
-
24) Why do organizations use budgeted rates instead of actual rates to allocate the costs of support departments to each other and to user departments and divisions? Explain. 14.4 Evaluate and select...
-
What is risk? What is/are the implication/s of risk to the set goals of a Business organization? Scan your environment, present a potential risk that is detrimental to anybody or anything. Provide a...
-
Indicate whether the statement is true or false. The probability can be greater than 1. Random variable values are determined by chance.
-
(a) Use integration by parts to show that (b) If f and g are inverse functions and f' is continuous, prove that (c) In the case where f and t are positive functions and b > a > 0, draw a diagram to...
-
Draw a simple, connected, undirected, weighted graph with 8 vertices and 16 edges, each with unique edge weights. Illustrate the execution of the Prim-Jarnik algorithm for computing the minimum...
-
Consider a modification of the deterministic version of the quick-sort algorithm where we choose the element at index n/2 as our pivot. Describe the kind of sequence that would cause this version of...
-
Can edge list E be omitted from the adjacency list representation while still achieving the time bounds given in Table 14.3? Why or why not? Method numVertices(), numEdges() vertices() edges()...
-
Use a HashMap to create a reusable class for choosing one of the 13 predefined colors in class Color. The names of the colors should be used as keys, and the predefined Color objects should be used...
-
Use SecureRandom method ints to generate a stream of 50 random numbers in the range 1 to 999, then filter the resulting stream elements to select only the odd numbers and display the results in...
-
(a) What percentage of those not completing high school were females? (b) What percentage of those not completing high school were males? (c) What percentage of those completing high school were...
Study smarter with the SolutionInn App