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
During a steady flow process, the change of energy with respect to time is zero. a)- true b)- false
Answers: 2
question
Engineering, 04.07.2019 18:10
Journeyman training is usually related (clo2) a)-to specific tasks b)-to cost analysis of maintenance task c)-to control process to ensure quality d)-to installation of machinery
Answers: 2
question
Engineering, 04.07.2019 18:20
Refrigerant-134a enters the compressor of a refrigerator as superheated vapor at 0.14 mpa and -10°c at a rate of 0.05 ka/s and leaves at 0.8 mpa and 50°c. the refrigerant is cooied in the condenser to 0.72 mpa and 26'c. it is then throttled to 0.15 mpa. sketch the t-s diagram for the system and evaluate: 6) the rate of heat removai from the refrigerated space (kw), it) the power input to the compressor (kw), ii) the isentropic efficiency of the compressor (%), and iv) the cop of the refrigerator.
Answers: 2
question
Engineering, 04.07.2019 18:20
Apiston-cylinder device contains 0.1 m3 of liquid water and 0.9 m3 of water vapor in equilibrium at 800 kpa. heat is transferred at constant pressure until the temperature of water reaches 350 °c. determine (a) the quality of water at the initial state (b) the work associated with this process, (c) the heat associated with this process.
Answers: 2
You know the right answer?
I am stuck trying to solve the following problem via Divide and Conquer:

You want to buy...
Questions
question
Spanish, 24.08.2019 13:10
question
Mathematics, 24.08.2019 13:20
question
Mathematics, 24.08.2019 13:20
Questions on the website: 13722361