samedi 21 mars 2015

Recursion and dynamic programming for maximization function


If I have an array of size n of natural numbers, consider two adversaries A and B that will take turns removing the front or the end of the array, and taking the natural number in that cell and adding it to their score. Upon successfully partitioning the array, I want A to win, but I know that B has a long-term maximization strategy. What can A do? The naive approach seems to be pick the larger number every time, but if picking the larger number is disadvantageous (it reveals an even larger number), the approach must change. Is there a recursive strategy that can give A victory?





Aucun commentaire:

Enregistrer un commentaire