'''simple docstring'''


from collections.abc import Callable

import numpy as np

def   A_      (       SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)			->np.array:
  lowercase_     =       int(np.ceil((x_end - xa) / step_size						)						)
  lowercase_     =       np.zeros((n + 1,)						)
  lowercase_     =       ya
  lowercase_     =       xa

  for k in range(SCREAMING_SNAKE_CASE_						):
    lowercase_     =       y[k] + step_size * ode_func(SCREAMING_SNAKE_CASE_ ,	y[k]						)
    lowercase_     =       y[k] + (
        (step_size / 2) * (ode_func(SCREAMING_SNAKE_CASE_ ,	y[k]						) + ode_func(x + step_size ,	SCREAMING_SNAKE_CASE_						))
    )
    x += step_size

  return y


if __name__ == "__main__":
       import doctest

       doctest.testmod()


'''simple docstring'''


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.
__snake_case						  =		10

def   A_      (       SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)			->int:
  for i in range(SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						):
    if array[i] == target:
      return i
  return -1

def   A_      (       SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)			->int:
  lowercase_     =       0
  lowercase_     =       len(SCREAMING_SNAKE_CASE_						)
  while left <= right:
    if right - left < precision:
      return lin_search(SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)

    lowercase_     =       (left + right) // 3 + 1
    lowercase_     =       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]:
      lowercase_     =       one_third - 1
    elif array[two_third] < target:
      lowercase_     =       two_third + 1

    else:
      lowercase_     =       one_third + 1
      lowercase_     =       two_third - 1
  else:
    return -1

def   A_      (       SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)			->int:
  if left < right:
    if right - left < precision:
      return lin_search(SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)
    lowercase_     =       (left + right) // 3 + 1
    lowercase_     =       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(SCREAMING_SNAKE_CASE_ ,	one_third - 1 ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)
    elif array[two_third] < target:
      return rec_ternary_search(two_third + 1 ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)
    else:
      return rec_ternary_search(one_third + 1 ,	two_third - 1 ,	SCREAMING_SNAKE_CASE_ ,	SCREAMING_SNAKE_CASE_						)
  else:
    return -1


if __name__ == "__main__":
       import doctest

       doctest.testmod()

       __snake_case						  =		input("""Enter numbers separated by comma:\n""").strip()
       __snake_case						  =		[int(item.strip()) for item in user_input.split(""",""")]
       assert collection == sorted(collection), f"List must be ordered.\n{collection}."
       __snake_case						  =		int(input("""Enter the number to be found in the list:\n""").strip())
       __snake_case						  =		ite_ternary_search(collection, target)
       __snake_case						  =		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""")

