subject

The Cookie Game Riley and Morgan play the following cookie game. Given is one set of n red cookies and another set of m green cookies. At every turn, a player must eat two cookies from one set and one cookie from the other set (i. e., either (i) two green cookies and one red cookie, or (ii) two red cookie sand one green cookie). The player who cannot move loses. Assuming Riley will begin the game, which player will win?
Write an efficient dynamic programming algorithm in pseudo-code that decides whether a winning strategy for one of the players exists, give a brief justification of the correctness of your algorithm, and analyze its runtime.
Your algorithm’s input parameters should include n, m∈N0 representing the given numbers of green and red cookies, respectively. As output, the algorithm should state whether Riley or Moran will win, or if there is no winning strategy for either player.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen tool
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Write the html code to make a link out of the text “all about puppies”. it should link to a pdf called “puppies.pdf” inside the “documents” folder. the pdf should open in a new window.
Answers: 2
question
Computers and Technology, 25.06.2019 01:00
Your computer will organize files into order. alphabetical chronological size no specific
Answers: 2
question
Computers and Technology, 25.06.2019 08:50
1. define independent-set as the problem that takes a graph g and an integer k and asks whether g contains an independent set of vertices of size k. that is, g contains a set i of vertices of size k such that, for any v and w in i, there is no edge (v,w) in g. show that independent-set is np-complete.
Answers: 3
You know the right answer?
The Cookie Game Riley and Morgan play the following cookie game. Given is one set of n red cookies...
Questions
question
History, 24.11.2021 07:10
question
Mathematics, 24.11.2021 07:10
question
Mathematics, 24.11.2021 07:10
question
Mathematics, 24.11.2021 07:10
Questions on the website: 13722367