Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91614623
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Section 1 introduction write an introduction statement

Section 1: Introduction Write an introduction statement introducing the topic that you are interested in exploring. This section should contain the following background: Identify an industry and company profile you wish ...

Penetration testing is a technique used to identify

Penetration testing is a technique used to identify security weaknesses in your network. Discuss a type of penetration testing and the different methods utilized to recognize vulnerabilities in your network.

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

You are running a memory-intensive multimedia application

You are running a memory-intensive multimedia application on your computer, which has 1 GB RAM installed. You observe that the computer momentarily stops responding when you switch between two multimedia applications. 1. ...

Sorted golf scores - need flowchartdesign a program that

Sorted Golf Scores - need flowchart Design a program that asks the user to enter 10 golf scores. The scores should be stored in an Integer array. Sort the array in ascending order and display its contents. Looking for "" ...

Suppose you have two algorithms blarg and wibble with time

Suppose you have two algorithms, blarg and wibble, with time complexity ?(n log n) and ?(n) respectively. blarg modifies the input, while wibble just checks something about the input and returns True or False. You write ...

Suppose a bowl has 9 chips one chip is labeled 1 three

Suppose a bowl has 9 chips. One chip is labeled "1", three chips are labeled "3", and five chips are labeled "5". Suppose two chips are selected at random with replacement. Let the random variable X equal the absolute di ...

Find minimal dfas for the following languages in each case

Find minimal dfa's for the following languages. In each case prove that the result is minimal. (1) L = {a n bm> :n≥2,m≥1}. (2)L = {a n :n ≥ 0,n ≠ 3} (3) L = {a n :n mod 3 = 0}∪{a n : n mod 5 = 1}

In defining demand and supply why do economists focus on

In defining demand and supply, why do economists focus on price while holding constant other factors that might have an impact on the behavior of buyers and sellers?

Write a program that takes as input an xy center value and

Write a program that takes as input an x,y center value and radii for two circles, draws them in a turtle (Python) window, and prints whether they intersect or not. You should show intersecting circles, and show non-inte ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As