Best way to get the highest sum from a Matrix (using Java but algorithm is the issue here)

Posted by user294896 on Stack Overflow See other posts from Stack Overflow or by user294896
Published on 2010-05-11T09:10:38Z Indexed on 2010/05/11 9:14 UTC
Read the original article Hit count: 169

Filed under:
|
|

Sorry I dont know the correct terminology to use but I have a 3x3 matrix like this

1 3 4 

5 4 5
2 2 5

and I want get the highest score by picking a value from each row/column but I cant pick the same row or column more than once , so the answer in this case is

3 + 5 + 5 = 13 (row0,col1 + row1,col0 + row2,col2)

4 + 5 + 5 = 14 is not allowed because would have picked two values from col2

I'm using Java, and typically the matrix would be 15 by 15 in size.

Is there a name for what Im trying to do, and whats the algorithm

thanks Paul

© Stack Overflow or respective owner

Related posts about matrix

Related posts about algorithm