human
Floor square root without using sqrt ( ) function : Recursive | Function to find the square root of the number N using BS.
If the range is still valid.
Find the mid - value of the range.
Base Case.
Condition to check if the left search space is useless.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to floor square root without using sqrt ( ) function : Recursive and the other steps required.
 def sqrtSearch ( low , high , N ) :
	if ( low <= high ) :
		mid = ( low + high ) // 2 ;
		if ( ( mid * mid <= N ) and ( ( mid + 1 ) * ( mid + 1 ) > N ) ) :
			return mid ;
		elif ( mid * mid < N ) :
			return sqrtSearch ( mid + 1 , high , N ) ;
		else :
			return sqrtSearch ( low , mid - 1 , N ) ;
	return low ;
if __name__ == " _ _ main _ _ " :
	N = 25 ;
	print ( sqrtSearch ( 0 , N , N ) )