Question: 1. Coin-collecting Problem. How would you modify the dynamic programming algorithm for the coin-collecting problem if some cells on the board are inaccessible for the
1. Coin-collecting Problem. How would you modify the dynamic programming algorithm for
the coin-collecting problem if some cells on the board are inaccessible for the robot?
(a) Explain, in words, how this algorithm is different from the ordinary one.
(b) Write pseudocode for this modified algorithm. The algorithm should have two inputs:C[1..n,1..m] that encodes the locations of the coins, and B[1..n,1..m] that encodes the
locations of the inaccessible squares on the board. Your algorithm should return the maximum number of coins that the robot can pick up.
Note that the robot has to start in the upper-left, and finish in the lower-right so the location of the barriers might make it impossible for the robot to solve the problem!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
