




"""simple docstring"""






def      _snake_case			(				lowercase__							,    lowercase__		):
				_lowerCamelCase     :			int    =    0
				_lowerCamelCase     :			List[str]    =    len(lowercase__		) - 1

				while left <= right:
								# avoid divided by 0 during interpolation
								if sorted_collection[left] == sorted_collection[right]:
												if sorted_collection[left] == item:
																return left
												else:
																return None

								_lowerCamelCase     :			Any    =    left + ((item - sorted_collection[left]) * (right - left)) // (
								    sorted_collection[right] - sorted_collection[left]
								)

								# out of range check
								if point < 0 or point >= len(lowercase__		):
												return None

								_lowerCamelCase     :			str    =    sorted_collection[point]
								if current_item == item:
												return point
								else:
												if point < left:
																_lowerCamelCase     :			Union[str, Any]    =    left
																_lowerCamelCase     :			int    =    point
												elif point > right:
																_lowerCamelCase     :			Any    =    right
																_lowerCamelCase     :			List[str]    =    point
												else:
																if item < current_item:
																				_lowerCamelCase     :			List[Any]    =    point - 1
																else:
																				_lowerCamelCase     :			str    =    point + 1
				return None







def      _snake_case			(				lowercase__							,    lowercase__							,    lowercase__							,    lowercase__		):

				# avoid divided by 0 during interpolation
				if sorted_collection[left] == sorted_collection[right]:
								if sorted_collection[left] == item:
												return left
								else:
												return None

				_lowerCamelCase     :			Optional[int]    =    left + ((item - sorted_collection[left]) * (right - left)) // (
				    sorted_collection[right] - sorted_collection[left]
				)

				# out of range check
				if point < 0 or point >= len(lowercase__		):
								return None

				if sorted_collection[point] == item:
								return point
				elif point < left:
								return interpolation_search_by_recursion(lowercase__							,    lowercase__							,    lowercase__							,    lowercase__		)
				elif point > right:
								return interpolation_search_by_recursion(lowercase__							,    lowercase__							,    lowercase__							,    lowercase__		)
				else:
								if sorted_collection[point] > item:
												return interpolation_search_by_recursion(
												    lowercase__							,    lowercase__							,    lowercase__							,    point - 1		)
								else:
												return interpolation_search_by_recursion(
												    lowercase__							,    lowercase__							,    point + 1							,    lowercase__		)







def      _snake_case			(				lowercase__		):
				if collection != sorted(lowercase__		):
								raise ValueError('Collection must be ascending sorted'		)
				return True


if __name__ == "__main__":
			import sys
			lowercase__     						=						0
			if debug == 1:
						lowercase__     						=						[10, 30, 40, 45, 50, 66, 77, 93]
						try:
									__assert_sorted(collection)
						except ValueError:
									sys.exit("""Sequence must be ascending sorted to apply interpolation search""")
						lowercase__     						=						67

			lowercase__     						=						interpolation_search(collection, target)
			if result is not None:
						print(F"{target} found at positions: {result}")
			else:
						print("""Not found""")





"""simple docstring"""






import math







def      _snake_case			(				lowercase__		):
				return math.sqrt(lowercase__		) * math.sqrt(lowercase__		) == num







def      _snake_case			(				lowercase__		):
				_lowerCamelCase     :			Optional[int]    =    0
				_lowerCamelCase     :			List[Any]    =    n
				while left <= right:
								_lowerCamelCase     :			str    =    (left + right) // 2
								if mid**2 == n:
												return True
								elif mid**2 > n:
												_lowerCamelCase     :			str    =    mid - 1
								else:
												_lowerCamelCase     :			Optional[int]    =    mid + 1
				return False


if __name__ == "__main__":
			import doctest

			doctest.testmod()