Question: 2 . Alice and Bob are playing a game. There is a linked list with n nodes, each with a single integer li . They

2. Alice and Bob are playing a game. There is a linked list with n nodes, each with a single integer li . They take turns choosing either the integer in the head node or tail node (and removing that node from the list) until the list is empty. The final score for a player is the sum of the numbers chosen by that player. (a) Give an example where the optimal strategy is not to always take the largest number. Explain your answer. (b) Design an efficient iterative dynamic programming algorithm to determine the final scores of Alice and Bob, and analyze the runtime. Alice and Bob have a lot of problemsolving skills, due to how many CSCI 170 examples they appeared in. Therefore, assume that Alice and Bob both play optimally.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!