from __future__ import annotations

# This is the precision for this function which can be altered.
# It is recommended for users to keep this number greater than or equal to 10.
_UpperCAmelCase            =		10




def     UpperCamelCase						(	__lowercase						:			int						,__lowercase						:			int						,__lowercase						:			list[int]						,__lowercase						:			int     ):
		'''simple docstring'''




		for i in range(__lowercase						,__lowercase     ):
				if array[i] == target:
						return i
		return -1




def     UpperCamelCase						(	__lowercase						:			list[int]						,__lowercase						:			int     ):
		'''simple docstring'''




		A_		:    List[Any]         =				0
		A_		:    Optional[int]         =				len(__lowercase     )
		while left <= right:
				if right - left < precision:
						return lin_search(__lowercase						,__lowercase						,__lowercase						,__lowercase     )

				A_		:    List[str]         =				(left + right) // 3 + 1
				A_		:    Optional[Any]         =				2 * (left + right) // 3 + 1

				if array[one_third] == target:
						return one_third
				elif array[two_third] == target:
						return two_third

				elif target < array[one_third]:
						A_		:    Tuple         =				one_third - 1
				elif array[two_third] < target:
						A_		:    List[Any]         =				two_third + 1

				else:
						A_		:    Optional[int]         =				one_third + 1
						A_		:    List[Any]         =				two_third - 1
		else:
				return -1




def     UpperCamelCase						(	__lowercase						:			int						,__lowercase						:			int						,__lowercase						:			list[int]						,__lowercase						:			int     ):
		'''simple docstring'''




		if left < right:
				if right - left < precision:
						return lin_search(__lowercase						,__lowercase						,__lowercase						,__lowercase     )
				A_		:    Tuple         =				(left + right) // 3 + 1
				A_		:    int         =				2 * (left + right) // 3 + 1

				if array[one_third] == target:
						return one_third
				elif array[two_third] == target:
						return two_third

				elif target < array[one_third]:
						return rec_ternary_search(__lowercase						,one_third - 1						,__lowercase						,__lowercase     )
				elif array[two_third] < target:
						return rec_ternary_search(two_third + 1						,__lowercase						,__lowercase						,__lowercase     )
				else:
						return rec_ternary_search(one_third + 1						,two_third - 1						,__lowercase						,__lowercase     )
		else:
				return -1


if __name__ == "__main__":
	import doctest

	doctest.testmod()

	_UpperCAmelCase            =		input("""Enter numbers separated by comma:\n""").strip()
	_UpperCAmelCase            =		[int(item.strip()) for item in user_input.split(""",""")]
	assert collection == sorted(collection), F"List must be ordered.\n{collection}."
	_UpperCAmelCase            =		int(input("""Enter the number to be found in the list:\n""").strip())
	_UpperCAmelCase            =		ite_ternary_search(collection, target)
	_UpperCAmelCase            =		rec_ternary_search(0, len(collection) - 1, collection, target)
	if resulta != -1:
		print(F"""Iterative search: {target} found at positions: {resulta}""")
		print(F"""Recursive search: {target} found at positions: {resulta}""")
	else:
		print("""Not found""")







from ..utils import DummyObject, requires_backends





class UpperCAmelCase						( metaclass=__A  ):


				'''simple docstring'''






				lowerCamelCase_    = ['''onnx''']
				def __init__(						self		,     *lowercase		,     **lowercase ):



						"""simple docstring"""





						requires_backends(self		,     ['onnx'] )
				@classmethod
				def   lowerCAmelCase_       (						cls		,     *lowercase		,     **lowercase ):



						"""simple docstring"""





						requires_backends(cls		,     ['onnx'] )







				@classmethod
				def   lowerCAmelCase_       (						cls		,     *lowercase		,     **lowercase ):



						"""simple docstring"""





						requires_backends(cls		,     ['onnx'] )






