State how you would recover the actual set s given a .

Assignment Help Data Structure & Algorithms
Reference no: EM13943758

1. SubsetSum (greedy algorithms)

A SubsetSum is defined as follows: given positive integers a1 . . . an (not necessarily distinct), and a positive integer t, find a subset S of (1 . . . n) such that ∑iεs ai = t, if it exists.

a) Suppose each ai is at least twice as large as the sum of all smaller numbers aj . Give a greedy algorithm to solve SubsetSum under this assumption.

b) Prove correctness of your greedy algorithm by stating and proving the loop invariant.

2) SubsetSum (dynamic programming ) Now suppose that the ai values are arbitrary. Design a dynamic programming algorithm to solve the SubsetSum problem. The running time of your algorithm should be polynomial in both n and t.

a) Give the definition of the array A you will use to solve this problem and state how you find out if there is such a set S from that array.

b) Give the recurrence to compute the elements of the array A, including initialization.

c) State how you would recover the actual set S given A .

d) Analyze the running time of your algorithm (including the step reconstructing S), in terms of n and t. hide problem

Reference no: EM13943758

Questions Cloud

What is maximum you will be willing to pay for investment : An investment promises to pay an annuity of $150 monthly payments for seven years, but the payments do not start now. The first payment will be received 3 years from today. What is the maximum you will be willing to pay for this investment if your re..
Estimate bad debt expense under percentage of credit sales : At December 31, 2009, Garner has a $1,000 credit balance in its allowance for doubtful accounts. Estimate the bad debt expense under the percentage of credit sales method.
Find the horizontal and vertical area moment of inertias : Find the horizontal and vertical area moment of inertias of the cross-section shown with respect to its centroid.
What was your percent return : HydroTech Corp stock was $50 per share a year ago when it was purchased. Since then, it paid an annual $4 per share dividend. The stock price is currently $55. If you owned 500 shares of HydroTech, what was your percent return?
State how you would recover the actual set s given a . : Prove correctness of your greedy algorithm by stating and proving the loop invariant.
What is this years dividend yield : Suppose a company has net income of 1,000,000 and a plowback ratio of 40%. There are 50,000 shares of stock outstanding. The company plans to increase dividends by 22% each year for the next 2 years and apply a 2.25% growth rate to dividends each yea..
Treasury bond or a corporate bond : Dana intends to invest $25,000 in either a Treasury bond or a corporate bond. The Treasury bond yields 5 percent before tax and the corporate bond yields 6 percent before tax
At the end of an investors three year horizon : A coupon bond which pays interest of $50 annually, has a par value of $1000, mature in 5 years, and is selling today a $114.52 discount from par value. the current yield on this bond is? Stock A has a current price of $40.00, a beta of 2.5, and divid..
Calculate the ending accounts receivable balance : Beginning accounts receivable were $10,000. All sales were on account and totaled $700,000. Cash collected from customers totaled $650,000. Calculate the ending accounts receivable balance.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Primitives-remove ambiguities in algorithm-s representation

Describe how the use of primitives helps remove ambiguities in an algorithm's representation.

  Diameter bounded minimum spanning tree of graph by prim-s

Modify Prim's or Kruskal's algorithm to determine diameter bounded minimum spanning tree of complete graph. A diameter bounded minimum spanning tree is spanning tree.

  Determine whether or not you believe this kind of sorting

question 1 imagine you are a part of a team that is tasked with writing a mobile app that will allow users to

  Draw a binary search tree for an array

Draw a binary search tree for an array of element from 0 to 20

  Implement a method to delete every node

Call the structure for the nodes of the tree WordNode, and call the references in this structure left and right. Use Strings to store words in the tree. Call the class implementing the binary search tree WordTree.

  Part 11 how many cells can be in a computers main memory if

part 11. how many cells can be in a computers main memory if each cells address can be represented by two hexadecimal

  Define file type

Define File Type and provide some of the important information to know about it and where do file types come from?

  Data type passed by reference

Write a C program that tests whether or not the following data types are passed by reference or by value, and prints what it discovers out to the terminal

  Write a procedure hamming

Write a procedure hamming(ascii, encoded) that converts the low-order 7 bits of ascii into an 11-bit integer codeword stored in encoded.

  Write down an all-pairs algorithm that is given a list of

question 1.algorithms a and b perform the same task. on input of size n algorithm a executes 0.5n2 steps and algorithm

  The binary search algorithm

- The "origin" of the Cartsian plane in math is the point where x and y are both zero. Declare a variable of type POINT named origin and set its data dields consistent with the mathematical notion of "origin".

  Describe a polynomial-time algorithm

Describe a polynomial-time algorithm that solves the following decision problem:

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd