Question: Suppose that you are given an n n checkerboard and a checker. You must move the checker from the bottom edge of the board

Suppose that you are given an n × n checkerboard and a checker. You must move the checker from the bottom edge of the board to the top edge of the board according to the following rule. At each step you may move the checker to one of three squares:
1. The square immediately above,
2. The square that is one up and one to the left (but only if the checker is not already in the leftmost column),
3. The square that is one up and one to the right (but only if the checker is not already in the rightmost column). Each time you move from square x to square y, you receive p(x, y) dollars. You are given p(x, y) for all pairs (x, y) for which a move from x to y is legal. Do not assume that p(x, y) is positive. Give an algorithm that figures out the set of moves that will move the checker from somewhere along the bottom edge to somewhere along the top edge while gathering as many dollars as possible. Your algorithm is free to pick any square along the bottom edge as a starting point and any square along the top edge as a destination in order to maximize the number of dollars gathered along the way. What is the running time of your algorithm?

Step by Step Solution

3.37 Rating (175 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Denote each square by the pair i j where i is the row number j is the column number and 1 i jn Our goal is to find a most profitable way from any squa... View full answer

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

Document Format (1 attachment)

Word file Icon

C-S-A (109).docx

120 KBs Word File

Students Have Also Explored These Related Algorithms Questions!