Computers and Technology

Consider a row of n coins of values v1, …, vn, where n is even. we play a game against an opponent by alternating turns. in each turn, a player selects either the first or last coin from the row, removes it from the row permanently, and receives the value of the coin. the goal is to maximize the total value of the coins collected. each player plays optimally.

1. give an example of a sequence of coins such that it is not optimal for the first player to start by picking the available coin of larger value. that is, the greedystrategy of always picking the larger coin is suboptimal. recall that n is even.

2. give an o(n2) dynamic programming algorithm to compute an optimal strategy for the first player. the first player should be able to make each move optimally in o(1) time. your algorithm should return the optimal strategy for the first player, not the final score.

3. define the subproblems you will use to solve this problem. define all variables you introduce.

4. write a recurrence expressing the optimal solution of the general subproblem in terms of optimal solutions of smaller subproblems. solve the base cases.

5. describe your algorithm in pseudocode. comment your code.

6. explain clearly and concisely why your algorithm is correct. restatements of steps of the algorithm will receive no credit.

7. analyze the running time of your algorithm, including the number of subproblems and the time spent per subproblem.

8. extend your algorithm to keep track of the optimal move at any point of the game.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:30, jonquil201
Where would you click to edit the chart data?
Answers: 1
image
Computers and Technology, 23.06.2019 12:00, deflox74
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
Answers: 1
image
Computers and Technology, 23.06.2019 13:50, mrfishyyyy
Explain how email technologies enable the exchange of messages between users. find out the typical parts of an email address and explain each part.
Answers: 1
image
Computers and Technology, 24.06.2019 10:30, brandon1748
You're programming an infinite loop. what must you include in your code to prevent crashes? in roblox
Answers: 2
Do you know the correct answer?
Consider a row of n coins of values v1, …, vn, where n is even. we play a game against an opponent b...

Questions in other subjects:

Konu
English, 04.02.2021 18:40
Konu
Mathematics, 04.02.2021 18:40