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

  Java program to find largest and smallest numbers

Create a Java program that will search a text document of strings representing numbers of type int and will write the largest and the smallest numbers to screen.

  Modify the pseudocode design

Modify the pseudocode design

  Develop the flow diagram of the information

Develop the flow diagram of the information and any control elements needed to ensure proper access for the information. A diagram of the information flow and any elements controlling proper access to the information it uses

  Using big-o notation state the runtime for this algorithm

1 consider searching algorithms on the following array of datanbsp22 21 9 4 16 2 10 14 20 31 26 19 17 28 8

  Create an algorithm to describe how to balance a checkbook

Create an algorithm to describe how to balance a checkbook for a company that has more than 100transactions.

  Write a function called maxsubsum that takes a matrix a

Write a function called maxsubsum that takes a matrix A as an input, computes the sum of elements in each of its submatrices, and finds the submatrix that has the maximum sum

  Create program algorithm in pseudocode to store quiz grades

The elementary school for which you are doing development work has asked you to create a program algorithm in pseudocode to store quiz grades for the students of a class

  Design algorithm that plans your optimal investment strategy

Prove that the problem of planning your optimal investment strategy exhibits optimal substructure and design an algorithm that plans your optimal investment strategy. what is the running time of your algorithm?

  Construct the minimal spanning tree using kruskal algorithm

Construct the minimal spanning tree using Kruskal's Algorithm. Construct the minimal spanning tree using Prim's Algorithm, using A as the root

  Implement two stacks using only one array

Write routines to implement two stacks using only one array. Your stack routines should not declare an overflow unless every slot in the array is used.

  Set the three elements of integer array counts to 0

Write statements that perform the following one-dimensional-array operations: Set the three elements of integer array counts to 0

  Determine the objective of a query simplifier describe the

question 1 what is the objective of a query simplifier? what are the idempotence rules used by query simplifier? give

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