7. Given a cost matrix C[0..N ][0..M] and a position (n, m) in C, we want to find the cost of the minimum cost path to reach

7. Given a cost matrix C[0..N ][0..M] and a position (n, m) in C, we want to find the cost of the minimum cost path to reach (n , m) from (0, 0). From a given cell (i, j), we can only traverse down to cell (i+1, j), right D aloon to cell (i,i+1) and diagonally down right to cell (i+1, j+1). We assume 275 24| that all costs are positive integers. 9 6 2 1 3 • Write a Dynamic Programming algorithm to solve this problem. 3 5 672 • Provide a complexity analysis of your algorithm. 4 5 1 2 2 • Test your algorithm using the cost matrix shown to find the minimum cost path from cell (0,0) to cell (4,4) and the final cost. • Which cell will cost most to reach from (0,0)?



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *