algorithm - Find best submatrix with least sum of differences between max element and other elements of size x*y of large matrix a*b -


given matrix a*b , find min sum of differences between max element , other elements of possible submatrixes of size xy

eg

2 3 4  5 6 1 

for submatrix of sizes 2*2

2 3 5 6  max = 6 sum of diffs = |6-2|+|6-3|+|6-5|+|6-6|              = 8    3 4  6 1  max =6 sum of diff = |6-3|+|6-4|+|6-6|+|6-1|             = 10  

ans = 8 minimum

surely brute force approach checking each possible submatrix , calculating diff between max , every element


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -