Algorithms 1st Edition

Chapter Problem

Chapter: Problem:
5 Stars(1 user)

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.


What is Chegg Study?

With Chegg Study, you get step-by-step solutions for odd and even answers at the back of the book Algorithms - 1st Edition and 2,500 others.
Chegg Study authors: Publishers, professors and post-grads
Textbook authors: Umesh Vazirani, Christos H. Papadimitriou, Christos Papadimitriou, Sanjoy Dasgupta
ISBN: 0073523402
ISBN-13: 9780073523408
View all editions
81% of students said using Chegg better prepared them for exams
2013 Chegg Homework Help Survey
  • Where do solutions come from?
  • What comes with membership?
  • What subjects are covered?

Sample Textbook Solution

Engineering Mechanics Dynamics, 2nd Edition, Chapter 6, Problem 15

Step-by-step solutions for this book and 2,500 others
Already used by over 1 million students to study better

Get Study Help from Chegg
