You and your eight-year-old nephew Elmo decide to play a simple card game. Atthe beginning of the game, the cards are dealt face up in a long row. Each card isworth a different number of points. After all the cards are dealt, you and Elmo taketurns removing either the leftmost or rightmost card from the row, until all the cardsare gone. At each turn, you can decide which of the two cards to take. The winner ofthe game is the player that has collected the most points when the game ends.Having never taken an algorithms class, Elmo follows the obvious greedystrategy—when it’s his turn, Elmo always takes the card with the higher point value.Your task is to find a strategy that will beat Elmo whenever possible. (It might seemmean to beat up on a little kid like this, but Elmo absolutely hates it when grown-upslet him win.)(a) Prove that you should not also use the greedy strategy. That is, show that thereis a game that you can win, but only if you do not follow the same greedystrategy as Elmo.(b) Describe and analyze an algorithm to determine, given the initial sequence ofcards, the maximum number of points that you can collect playing against Elmo.(c) Five years later, Elmo has become a much stronger player. Describe andanalyze an algorithm to determine, given the initial sequence of cards, themaximum number of points that you can collect playing against a perfectopponent
About author
Related posts
Maria manages a bakery that specializes in ciabatta bread, ans she has the following information on the bakery’s demand and costs: Bread sold per hour... Continue reading
Please submit one to two paragraphs regarding what you obtained from this course and how you will apply these concepts to your nursing practice or... Continue reading
Within your final composition you will be addressing: Managed Health Care Quality – Address what the emerging managed healthcare delivery model Patient-Centered Medical Homes has... Continue reading
Section 1: Project Plan All previous documentation should be combined into one document that will serve as the statement of work for the project. Your... Continue reading
Identify regulatory agencies that regulate health and the health care system within the US, create a table listing your 5 regulatory agencies and address the... Continue reading
Leave a reply