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, 21.06.2019 16:30
You have inserted new slides based on a word outline. how do you format these new slides to match the powerpoint presentation formatting? a. select all slides in the presentation and click format on the home tab. b. select the new slides and click reset on the home tab. c. select all slides in the presentation and click reset on the home tab. d. select the new slides and click format on the home tab.
Answers: 2
question
Computers and Technology, 22.06.2019 12:00
Which of the following does 3d animation create an illusion of on the screen? a. depth b. emotion c. length d. dialogue
Answers: 1
question
Computers and Technology, 22.06.2019 14:40
You are working with a professional edition organization. they wish to install the expense tracker which requires the use of 4 custom tabs, 3 custom objects, and one custom app. if the company is already using 4 applications, 36 custom objects, and 7 custom tabs, what will happen when they try to install expense tracker?
Answers: 1
question
Computers and Technology, 22.06.2019 21:30
The graph shows median weekly earnings for full-time workers according to education level. which can you not conclude?
Answers: 2
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
Spanish, 20.07.2019 00:00