lundi 23 mars 2015

Recursion and dynamic programming for maximization function [on hold]


Player A and player B are given an array of size n. Each cell contains a positive integer, or 0. A and B take turns as given: Player A keeps either the first or the last cell, then player B keeps the first or last cell of what remains (an array of size n-1). This continues until the players have partitioned the array. Does a recursive strategy exist such that player A can maximize his or her total score, if the total score is the sum of the partition of the array (which is composed of the cells that the player has chosen)? The naive solution seems to be recursively choosing the MAX_ELEMENT of the two choices, but I'm not sure if that's the best choice of strategy. Does a better one exist to maximize the score?


If such an algorithm exists, how can I analyze the time complexity of the algorithm via recursion and dynamic programming?





Aucun commentaire:

Enregistrer un commentaire