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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 20:00, jumpgirll
The blank button automatically displays next to the data when you select a range of numeric data which is an available option for creating a chart
Answers: 3
image
Computers and Technology, 23.06.2019 10:50, whyidkmyself
Your friend kayla is starting her own business and asks you whether she should set it up as a p2p network or as a client-server network. list three questions you might ask to kayla decide which network to use and how her answers to those questions would affect your recommendation.
Answers: 2
image
Computers and Technology, 23.06.2019 18:00, larry5007
Freya realizes she does not have enough in her bank account to use the debit card. she decides to use a credit card instead. which questions should freya answer before using a credit card? check all that apply. can i pay at least the minimum payment each month? can i make payments on time and avoid late fees? will i have to take out a loan? how much in finance charges can i afford to pay? should i talk to a consumer credit counseling service?
Answers: 1
image
Computers and Technology, 24.06.2019 02:10, trint5952
Aspeed limit sign that says "night" indicates the legal speed between sunset and sunrise.
Answers: 2
You know the right answer?
Consider the following game. A "dealer" produces a sequence s1 sn of "cards," face up, where each ca...

Questions in other subjects:

Konu
Mathematics, 04.12.2020 04:40
Konu
Mathematics, 04.12.2020 04:40
Konu
Mathematics, 04.12.2020 04:40
Konu
Arts, 04.12.2020 04:40