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
Refrigerant 134a enters an insulated compressor operating at steady state as saturated vapor at -26°c with a volumetric flow rate of 0.18 m3/s. refrigerant exits at 9 bar, 70°c. changes in kinetic and potential energy from inlet to exit can be ignored. determine the volumetric flow rate at the exit, in m3/s, and the compressor power, in kw.
Answers: 1
question
Engineering, 04.07.2019 18:10
Ahot wire operates at a temperature of 200°c while the air temperature is 20°c. the hot wire element is a tungsten wire of 5 um diameter and 2 mm in length. plot using excel current, heat transfer and heat generated by the wire for air velocity varying from 1-10 m/s in steps of lm/s? matlab the sensor voltage output, resistance, or assume nu 0.989 re033pr13 take air properties at tr (200°c20°c)/2 = 110°c properties of tungsten: c 0.13 kj/kg.k 3 p 19250 kg/m k (thermal conductivity) = 174 w/m.k
Answers: 2
question
Engineering, 04.07.2019 18:20
Find the kinematic pressure of 160kpa. for air, r-287 j/ kg k. and hair al viscosity of air at a temperature of 50°c and an absolute (10 points) (b) find the dynamic viscosity of air at 110 °c. sutherland constant for air is 111k
Answers: 3
question
Engineering, 04.07.2019 18:20
An engine runs on the ideal diesel cycle. the cycle has a compression ratio of 20 and a cutoff ratio of 2. the highest temperature in the cycle is 1200 k. if the heat into the system is 300 kj/kg of working fluid and using variable specific heats determine the work produced per mass of working fluid
Answers: 3
You know the right answer?
I am stuck trying to solve the following problem via Divide and Conquer:

You want to buy...
Questions
question
Mathematics, 05.05.2020 17:31
question
Mathematics, 05.05.2020 17:31
Questions on the website: 13722367