Computers and Technology

The residents of the underground city of Zion defend themselves through a combination of kung fu, heavy artillery, and efficient algorithms. Recently they have become interested in automated methods that can help fend off attacks by swarms of robots. Here is what one of these robot attacks looks like.
• A swarm of robots arrives over the course of n seconds; in the i-th second, xi robots arrive. Based on remote sensing data, you know this sequence x1, x2, . . . , xn in advance.
• You have at your disposal an electromagnetic pulse (EMP), which can destroy some of the robots as they arrive; the EMP’s power depends on how long it has been allowed to charge up. To make it precise, there is a function f(·) so that if j seconds have passed since the EMP was last used, then it is capable of destroying up to f(j) robots.
• So specifically, if it is used in the k-th second, and it has been j seconds since it was previously used, then it destroys min(xk, f(j)) robots. (After this use, it will be completely drained.)
• We will also assume that EMP starts off completely drained, so if it is used for the first time in the j-th second, then it is capable of destroying up to f(j) robots.
The problem is: Given the data on robot arrivals x1, x2, . . . , xn, and given the recharging function f(·), choose the points in time at which you are going to activate the EMP so as to destroy as many robots as possible.
(a) Show that the following algorithm does not correctly solve this problem, by giving an instance on which it does not return the correct answer.
Schedule-EMP(x1, . . . , xn)
Let j be the smallest number for which f(j) ≥ xj
(If no such j exists then set j = n)
Activate the EMP in the j-th second
If n − j ≥ 1 then
Continue recursively on the input xj+1, . . . , xn
(i. e. invoke Schedule-EMP(xj+1, . . . , xn)
In your example, say, what the correct answer is and also what the algorithm above finds.
(b) Give an efficient algorithm that takes the data on robot arrivals x1, . . . , xn, and the recharging function f(·), and returns the maximum number of robots that can be destroyed by a sequence of EMP activations.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:00, ladyree8721
Which of the following physical laws can make the flow of water seem more realistic? a. motion b. gravity c. fluid dynamics d. thermodynamics
Answers: 2
image
Computers and Technology, 23.06.2019 07:00, sugaree95
What are three software programs for mobile computing?
Answers: 1
image
Computers and Technology, 24.06.2019 00:40, sierravick123owr441
Use a software program or a graphing utility with matrix capabilities to solve the system of linear equations using an inverse matrix. x1 + 2x2 − x3 + 3x4 − x5 = 6 x1 − 3x2 + x3 + 2x4 − x5 = −6 2x1 + x2 + x3 − 3x4 + x5 = 3 x1 − x2 + 2x3 + x4 − x5 = −3 2x1 + x2 − x3 + 2x4 + x5 = 5
Answers: 3
image
Computers and Technology, 24.06.2019 07:00, AnaiyaKirksey8
You are most likely to automatically encode information about
Answers: 1
Do you know the correct answer?
The residents of the underground city of Zion defend themselves through a combination of kung fu, he...

Questions in other subjects: