Abstraction of Binary Search | ''Function to find X such that it is less than the target value and function is f(x) = x ^ 2 ; '' Initialise start and end ; '' Loop till start <= end ; '' Find the mid ; '' Check for the left half ; Store the result ; Reinitialize the start point ; '' Check for the right half ; '' Print maximum value of x  such that x ^ 2 is less than the  targetValue ; ''Driver Code ; '' Given targetValue; ; '' Function Call
def findX ( targetValue ) : NEW_LINE INDENT start = 0 ; NEW_LINE end = targetValue ; NEW_LINE mid = 0 ; NEW_LINE while ( start <= end ) : NEW_LINE INDENT mid = start + ( end - start ) // 2 ; NEW_LINE if ( mid * mid <= targetValue ) : NEW_LINE INDENT result = mid NEW_LINE start = mid + 1 ; NEW_LINE DEDENT else : NEW_LINE INDENT end = mid - 1 ; NEW_LINE DEDENT DEDENT print ( result ) ; NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT targetValue = 81 ; NEW_LINE findX ( targetValue ) ; NEW_LINE DEDENT