Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Coin Collection Problem. In the coin collection problem, coins are placed in

ID: 3682470 • Letter: T

Question

The Coin Collection Problem. In the coin collection problem, coins are placed in cells of an n times sign m board, with no more than one coin per cell. A robot, located in the upper left cell, position (1, 1), of the board, needs to collect as many of the coins as possible and bring them to the bottom right cell (position (n, m)). In each step, the robot can move either one cell to the right or one cell down from its current location. When the robot visits a cell with a coin, it always picks up the coin located there. Give pseudocode for a dynamic programming algorithm to find the maximum number of coins the robot can collect and a path it needs to follow in solving the coin collection problem. Analyze the time and space requirements of your algorithm. Now, modify the dynamic programming algorithm in part (a) for the case where some cells on the board are inaccessible to the robot. Are there any changes to the time or space requirements of your algorithm? Apply your algorithm to the board in Figure 3, where the inaccessible cells are marked by X's. (State the maximum number of coins and a path the robot needs to follow to collect them.) How many optimal paths are there for the board in Figure 3? A 5 times sign 6 board for the coin collection problem, Question 8, parts (c) and (d).

Explanation / Answer

#include #include #define BIG_NUMBER 10000 void setTheValues(int,int*); void inputValues(int, int*); int main() { /* w is for small weights*/ /* v is to keep the track of what have we added*/ /* p is to keep track of previous values */ /* min is for minimum number of small weights that would keep sub problems */ int *w,*v,*p,*min; /* e is to stop the screen */ /* s is the weight we need to reach */ /* n is the number of coins*/ int e, s, n; printf("Input the number of small weights->"); scanf("%d",&n); w=(int*)calloc((n+1),sizeof(int)); v=(int*)calloc((n+1),sizeof(int)); p=(int*)calloc((n+1),sizeof(int)); min=(int*)calloc((n+1),sizeof(int)); printf("Input the big weight to reach->"); scanf("%d",&s); setTheValues(s,min); inputValues(n,w); for(int i=1; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote