Function to perform binary search on an array sorted in decreasing order
function binarySearchRowDec ( arr , row , l , r , x ) { while ( l <= r ) { var mid = parseInt ( ( l + r ) / 2 ) ; if ( arr [ row ] [ mid ] == x ) return mid ; if ( arr [ row ] [ mid ] < x ) r = mid - 1 ; else l = mid + 1 ; } return - 1 ; }