calculating maximum difference of two elements such that rowSum [ i ] < rowsum [ j ]
$ max_diff = $ rowSum [ 1 ] - $ rowSum [ 0 ] ; $ min_element = $ rowSum [ 0 ] ; for ( $ i = 1 ; $ i < $ m ; $ i ++ ) {