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, 03.07.2019 19:30
When using the ohmmeter function of a digital multimeter, the leads are placed in what position relative to the component being tested? a. parallel b. control c. series d. line
Answers: 3
question
Engineering, 04.07.2019 18:10
Manometers are good examples of measuring instruments, nowadays they are not as common as before. a)-capacitive probe gauges b)-gravitational gauges deformation ) gauges d)-digital gauges
Answers: 1
question
Engineering, 04.07.2019 18:10
An air compression refrigeration system is to have an air pressure of 100 psia in the brine tank and an allowable air temperature increase of 60°f for standard vapor compression cycle temperatures of 77 f entering the expansion cylinder and 14 f entering the compression cylinder, calculate the coefficient of performance a. 2.5 b 3.3 c. 4.0 d. 5.0
Answers: 3
question
Engineering, 04.07.2019 18:20
The characteristic roots of a dynamic system are: 1.7920 1.8160 i, -1.7920 1.8160 i, -0.4160 what is the order of this system? what are the settling time and damping ratio of the system?
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
Chemistry, 18.03.2021 01:10
question
Mathematics, 18.03.2021 01:10
question
Biology, 18.03.2021 01:10