subject

Consider the following game. A "dealer" produces a sequence s1 sn of "cards," face up, where each card si has a value vi. Then two players take turns picking a card from the sequence, but can only pick the first or the last card of the (remaining) sequence. The goal is to collect cards of largest total value. (For example, you can think of the cards as bills of different denominations.) Assume n is even. (a) Show a sequence of cards such that it is not optimal for the first player to start by picking up the available card of larger value. That is, the natural greedy strategy is suboptimal.
(b) Give an O (n2) algorithm to compute an optimal strategy for the first player. Given the initial sequence, your algorithm should precompute in O (n2) time some information, and then the first player should be able to make each move optimally in O (1) time by looking up the precomputed information.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 13:10
Java g array testgrades contains num_vals test scores. write a for loop that sets sumextra to the total extra credit received. full credit is 100, so anything over 100 is extra credit. ex: if testgrades = {101, 83, 107, 90}, then sumextra = 8, because 1 + 0 + 7 + 0 is 8.
Answers: 1
question
Computers and Technology, 22.06.2019 06:00
Which of the following is a way that advancements in technology improve humans' ability to measure air quality and protect human health? a. air quality data gathered by new instruments can be used to reduce exposure to pollutants. b. new technologies enable natural and human-made pollution sources to be located and monitored. c. air quality data gathered by new instruments can be used to predict trends in pollution over time. d. new technologies allow governments to make informed decisions about the regulation of pollution. (choose more than one)
Answers: 2
question
Computers and Technology, 22.06.2019 10:00
Create a word problem that involves calculating the volume and surface area of a three-dimensional object. cube: surface area 6 s2 , volume s3
Answers: 3
question
Computers and Technology, 22.06.2019 11:30
One subtask in the game is to roll the dice. explain why is roll the dice an abstraction.
Answers: 3
You know the right answer?
Consider the following game. A "dealer" produces a sequence s1 sn of "cards," face up, where each ca...
Questions
question
Arts, 18.02.2021 19:30
question
French, 18.02.2021 19:30
question
Mathematics, 18.02.2021 19:30
question
Advanced Placement (AP), 18.02.2021 19:30
Questions on the website: 13722360