Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following game. There is a sequence c1 ..cn of coins, where each co

ID: 3533843 • Letter: C

Question

Consider the following game. There is a sequence c1 ..cn of coins, where each coin ci has value ci.

Then two players take turns picking a coin from the sequence, but can only pick the first or the last coin of the (remaining) sequence. The goal is to collect coins of the largest total value. For this problem, n is even.

Give an efficient algorithm to determine the maximum possible value for the first player (assuming player two plays optimally), and analyze the running time. Solved by dynamic programming

Explanation / Answer

carlstrom.com/stanford/cs161/ps5sol.pdf

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote