subject

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.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:00
)a grad student comes up with the following algorithm to sort an array a[1..n] that works by first sorting the first 2/3rds of the array, then sorting the last 2/3rds of the (resulting) array, and finally sorting the first 2/3rds of the new array. 1: function g-sort(a, n) . takes as input an array of n numbers, a[1..n] 2: g-sort-recurse(a, 1, n) 3: end function 4: function g-sort-recurse(a, `, u) 5: if u ⒠` ≤ 0 then 6: return . 1 or fewer elements already sorted 7: else if u ⒠` = 1 then . 2 elements 8: if a[u] < a[`] then . swap values 9: temp ↠a[u] 10: a[u] ↠a[`] 11: a[`] ↠temp 12: end if 13: else . 3 or more elements 14: size ↠u ⒠` + 1 15: twothirds ↠d(2 ◠size)/3e 16: g-sort-recurse(a, `, ` + twothirds ⒠1) 17: g-sort-recurse(a, u ⒠twothirds + 1, u) 18: g-sort-recurse(a, `, ` + twothirds ⒠1) 19: end if 20: end function first (5 pts), prove that the algorithm correctly sorts the numbers in the array (in increasing order). after showing that it correctly sorts 1 and 2 element intervals, you may make the (incorrect) assumption that the number of elements being passed to g-sort-recurse is always a multiple of 3 to simplify the notation (and drop the floors/ceilings).
Answers: 3
question
Computers and Technology, 22.06.2019 12:50
You have just been hired as an information security engineer for a large, multi-international corporation. unfortunately, your company has suffered multiple security breaches that have threatened customers' trust in the fact that their confidential data and financial assets are private and secured. credit-card information was compromised by an attack that infiltrated the network through a vulnerable wireless connection within the organization. the other breach was an inside job where personal data was stolen because of weak access-control policies within the organization that allowed an unauthorized individual access to valuable data. your job is to develop a risk-management policy that addresses the two security breaches and how to mitigate these risks.requirementswrite a brief description of the case study. it requires two to three pages, based upon the apa style of writing. use transition words; a thesis statement; an introduction, body, and conclusion; and a reference page with at least two references. use a double-spaced, arial font, size 12.
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
Write a full class definition for a class named player , and containing the following members: a data member name of type string .a data member score of type int .a member function called setname that accepts a parameter and assigns it to name . the function returns no value.a member function called setscore that accepts a parameter and assigns it to score . the function returns no value.a member function called getname that accepts no parameters and returns the value of name .a member function called getscore that accepts no parameters and returns the value of score .this is what i have, aparently this is wrong: class player{private: string name; int score; public: void player: : setname (string n){name =n; }void player: : setscore (int s){score = s; }string player: : getname (){return name; }int player: : getscore (){return score; }};
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
Negative methods of behavior correction include all but this: sarcasm verbal abuse setting an example for proper behavior humiliation
Answers: 1
You know the right answer?
The residents of the underground city of Zion defend themselves through a combination of kung fu, he...
Questions
question
Mathematics, 20.11.2020 16:50
question
Mathematics, 20.11.2020 16:50
question
Mathematics, 20.11.2020 16:50
Questions on the website: 13722363