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, 23.06.2019 05:20
What did creator markus “notch" persson initially call his game
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
Which of these is a benefit of using objects in a powerpoint presentation? a. collaborators can create the external files while you create and edit the slide show. b. you can easily change the theme and design of the presentation. c. you can have older data in the source file while having up-to-date data in the presentation. d. collaborators can easily share the presentation.
Answers: 2
question
Computers and Technology, 24.06.2019 14:30
Which computer network component connects two different networks together and allows them to communicate? a is a node (or a device) that connects two different networks together and allows them to communicate.
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
File i/o activity objective: the objective of this activity is to practice working with text files in c#. for this activity, you may do all code in the main class. instructions: create an app that will read integers from an input file name numbers.txt that will consist of one integer per record. example: 4 8 25 101 determine which numbers are even and which are odd. write the even numbers to a file named even.txt and the odd numbers to a file named odd.txt.
Answers: 3
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, 04.08.2019 19:00
Questions on the website: 13722363