lowerbound function
def lowerBound ( vec , low , high , element ) : NEW_LINE INDENT array = [ 0 ] * ( len ( vec ) ) NEW_LINE k = 0 NEW_LINE for val in vec : NEW_LINE INDENT array [ k ] = val NEW_LINE k += 1 NEW_LINE DEDENT while ( low < high ) : NEW_LINE INDENT middle = low + int ( ( high - low ) / 2 ) NEW_LINE if ( element > array [ middle ] ) : NEW_LINE INDENT low = middle + 1 NEW_LINE DEDENT else : NEW_LINE INDENT high = middle NEW_LINE DEDENT DEDENT return low + 1 NEW_LINE DEDENT