Function to perform binary search on an array sorted in increasing order l and r represent the left and right index of the row to be searched
def binarySearchRowInc ( arr , row , l , r , x ) : NEW_LINE INDENT while l <= r : NEW_LINE INDENT mid = ( l + r ) // 2 NEW_LINE if arr [ row ] [ mid ] == x : NEW_LINE INDENT return mid NEW_LINE DEDENT elif arr [ row ] [ mid ] < x : NEW_LINE INDENT l = mid + 1 NEW_LINE DEDENT else : NEW_LINE INDENT r = mid - 1 NEW_LINE DEDENT DEDENT return - 1 NEW_LINE DEDENT