subject

Suppose you have n coins in a row, and the kth coin in the row has the value vk. You play a 2-player game, where each player takes turns removing a single coin: either the first or last coin in a row. For example, suppose we have 5 coins in the row, and the values are v1 = 5,v2 = 10,v3 = 15,v4 = 5,v5 = 10. On your first turn, you could take coin 1, giving you a value of 5, or coin 5, giving you a value of 10. Then, your opponent could take one from either end (either 1,4 or 2,5, depending on your first move). The best you can do is to take coin 5 (+10), your opponent will then take coin 1 (+5), you then take coin 2 (+10), your opponent takes coin 3 (+15), and then you take coin 4 (+5). This leaves you with a value of 25 and your opponent with a value of 20. Required:
Given an arbitrary number of coins n and a list v1...vn of values, give a dynamic programming algorithm to determine the maximum value that you can get in this game, assuming you go first.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:00
You need a reliable network for about twenty-five computers that will be distributed across a large building. it is important that the network be relatively cheap. which topology should you use?
Answers: 1
question
Computers and Technology, 22.06.2019 16:20
Consider the following statements, then select one of the answers below: the signal() function shown below registers "sig_handler()" as the signal handler function for the sigkill signal, without the complexity of using when the sigkill signal is sent to a process running this code, by a user typing "kill -kill ", where the correct process id is used for to target the process, sig_handler() will be executed.
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Quick pl which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
:you areto design the controller for alight that functions both as an ordinary light and also as a motion activated light and alarm. a.if the manual switch s is on, then the light l is on. b.besides the manual switch, there is a motion detector, m1, which activatesthis light.c.if motion is detected but the light is on anyway because s is on, only then a secondoutput a, an alarm, is turned on. d.the disable switch, d, disables the motion activated light and alarmbut leaves manual control operation of the light using switch s.(i)read the problem statement and clearly identify the inputs and outputs for the circuit you are designing. (ii)create the truth table for this system; include the light, alarm, switch, disable, and the motion sensor.(iii)draw a schematic of this system.
Answers: 1
You know the right answer?
Suppose you have n coins in a row, and the kth coin in the row has the value vk. You play a 2-player...
Questions
question
Mathematics, 12.11.2020 17:40
question
Mathematics, 12.11.2020 17:40
question
Health, 12.11.2020 17:40
question
Chemistry, 12.11.2020 17:40
Questions on the website: 13722363