subject
Engineering, 21.02.2020 22:46 summeredki

I am stuck trying to solve the following problem via Divide and Conquer:

You want to buy a new laptop and a new phone but you don’t know how much to spend on each item. You have done your research and have quantified how happy you will be spending your money on each of the items. You know that if you spend I dollars on a laptop and j dollars on a phone, your total happiness is ai+bj, for two non-decreasing sequences a0, a1, . . . , an and b0, b1, . . . , bn that you have calculated. Given that you have a budget of k dollars, how should you spend your money? Your goal is now to calculate the maximum achievable happiness for some budget k∈{0, ..., n}, i. e. ck= maxi∈{0,...,n} ai+bk-i. Before solving the problem, you observed that for some items the rate of increase in your happiness drops as you spend more money on the item. We call such a sequence si concave, which means that si−si-1≥si+1−si when 1 ≤ i < n. We will now proceed based on which of the sequences a and b(if any) is concave.
Part B: Only sequence b is concave while a is not.
3. (Not to be turned in.) Observe that any algorithm for computing ck in this case can be used to find the maximum element in a given unsorted list of length k. This implies that computing ck requires Ω(k) time.
4. Let i(k) be the largest index that maximizes the sum a_i+b_(k-i). Show that when b is concave, i(k) is non-decreasing as a function of k, i. e. i(k)≤i(k+ 1).
5. Assuming that b is concave but a is not, give a divide-and-conquer algorithm to compute the entire sequence ck for all k= 0,1, . . . , n in time O(nlogn). Assume for simplicity and without loss of generality that n= 2^L. Give a brief (2-3 line), informal argument for correctness.

I am stuck on part 5. It doesn't seem like I can directly apply the divide and conquer technique. I see that the i for maximum happiness for a budget k does not decrease as k increases, so I see that some work could be saved by not searching in a for values of i that are below the maximum i for budget before k. I don't see how to make this nlogn though. A push in the right direction would be seriously appreciated.

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Different types of steels contain different elements that alter the characteristics of the steel. for each of the following elements, explain what the element does when alloyed with steel.
Answers: 2
question
Engineering, 04.07.2019 18:10
Which of the following refers to refers to how well the control system responds to sudden changes in the system. a)-transient regulation b)- distributed regulation c)-constant regulation d)-steady-state regulation
Answers: 1
question
Engineering, 04.07.2019 18:20
Avolume of 2.65 m3 of air in a rigid, insulated container fitted with a paddle wheel is initially at 264 k, 5.6 bar. the air receives 432 kj by work from the paddle wheel. assuming the ideal gas model with cv = 0.71 kj/kg • k, determine for the air the amount of entropy produced, in kj/k
Answers: 2
question
Engineering, 04.07.2019 19:20
Determine (a) the maximum thermal efficiency of reversible power cycles operating between a hot reservoir at 1000°c and a cold reservoir at 200°c and (b) the maximum cops for reversible refrigeration and heat pump cycies, respectively, between 28°c and 14°c.
Answers: 1
You know the right answer?
I am stuck trying to solve the following problem via Divide and Conquer:

You want to buy...
Questions
Questions on the website: 13722363