# Data Structures Homework

You are given an (n x n) chessboard and you start at your location of choice (removing confusing statement) on the first row. You have to find the optimal (least-cost) path from the top of the chessboard to the bottom. cost[i][j] represents the cost of moving onto square (i,j) of the chessboard. You move down one row at each step along your path. You may move to the square immediately below you or the squares diagonally below you. That is, when you on square (i,j), you can move down to either (i+1,j), (i+1,j-1), or (i+1,j+1).

Your method optimalPath() should use dynamic programming to solve this problem. Define your recurrence equation g(i,j) (which you should represent by an int[][] in your method) to be the cost of the optimal path from the first row to location (i,j).

/

\ c(i,j) if i = 0 (base case, first row)

g(i,j) = <

/ <figure this part out> if i > 0 (recursive case, depends on row (i-1))

\

PLEASE NOTE: The ArrayLinearList containts the column numbers of the path. For the example above, the resulting ArrayLinearList will contain [2, 1, 1, 2, 3].

Use the following program shell:

package dataStructures;

class OptimalPath {

public static ArrayLinearList optimalPath(int n, int [][]cost) {

}

// create helper methods if you need

}

## Deliverables

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.

## Platform

Java

Habilidades: Engenharia, Java, MySQL, PHP, Arquitetura de software, Teste de Software

( 3 comentários ) United States

ID do Projeto: #3026476

## Premiar a:

bogdanstan

See private message.

\$10 USD em 3 dias
(195 Avaliações)
5.7

## 6 freelancers estão ofertando em média \$29 para este trabalho

bogdan123vw

See private message.

\$22.95 USD in 3 dias
(48 Comentários)
3.8
shashikhanvw

See private message.

\$85 USD in 3 dias
(15 Comentários)
3.8
PDan

See private message.

\$17 USD in 3 dias
(9 Comentários)
3.4
akindosolutions

See private message.

\$29.75 USD in 3 dias
(4 Comentários)
2.3
coderx2k

See private message.

\$8.5 USD in 3 dias
(0 Comentários)
0.0