


def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		Dict       ,  SCREAMING_SNAKE_CASE_   :		Any	):





			"""simple docstring"""




			UpperCamelCase         =					0
			UpperCamelCase         =					len(SCREAMING_SNAKE_CASE_	) - 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

						UpperCamelCase         =					left + ((item - sorted_collection[left]) * (right - left)) // (
						    sorted_collection[right] - sorted_collection[left]
						)

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

						UpperCamelCase         =					sorted_collection[point]
						if current_item == item:
									return point
						else:
									if point < left:
												UpperCamelCase         =					left
												UpperCamelCase         =					point
									elif point > right:
												UpperCamelCase         =					right
												UpperCamelCase         =					point
									else:
												if item < current_item:
															UpperCamelCase         =					point - 1
												else:
															UpperCamelCase         =					point + 1
			return None






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		str       ,  SCREAMING_SNAKE_CASE_   :		List[str]       ,  SCREAMING_SNAKE_CASE_   :		Optional[Any]       ,  SCREAMING_SNAKE_CASE_   :		Optional[int]	):





			"""simple docstring"""




			if sorted_collection[left] == sorted_collection[right]:
						if sorted_collection[left] == item:
									return left
						else:
									return None

			UpperCamelCase         =					left + ((item - sorted_collection[left]) * (right - left)) // (
			    sorted_collection[right] - sorted_collection[left]
			)

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

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






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		str	):





			"""simple docstring"""




			if collection != sorted(SCREAMING_SNAKE_CASE_	):
						raise ValueError("""Collection must be ascending sorted"""	)
			return True


if __name__ == "__main__":
			import sys
			__snake_case            =   0
			if debug == 1:
						__snake_case            =   [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")
						__snake_case            =   67

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








import qiskit






def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		int = 2	):





			"""simple docstring"""




			UpperCamelCase         =					qubits

			# Using Aer's simulator
			UpperCamelCase         =					qiskit.Aer.get_backend("""aer_simulator"""	)

			# Creating a Quantum Circuit acting on the q register
			UpperCamelCase         =					qiskit.QuantumCircuit(SCREAMING_SNAKE_CASE_       ,  SCREAMING_SNAKE_CASE_	)

			# Adding a H gate on qubit 0 (now q0 in superposition)
			circuit.h(0	)

			for i in range(1       ,  SCREAMING_SNAKE_CASE_	):
						# Adding CX (CNOT) gate
						circuit.cx(i - 1       ,  SCREAMING_SNAKE_CASE_	)

			# Mapping the quantum measurement to the classical bits
			circuit.measure(list(range(SCREAMING_SNAKE_CASE_	)	)       ,  list(range(SCREAMING_SNAKE_CASE_	)	)	)

			# Now measuring any one qubit would affect other qubits to collapse
			# their super position and have same state as the measured one.

			# Executing the circuit on the simulator
			UpperCamelCase         =					qiskit.execute(SCREAMING_SNAKE_CASE_       ,  SCREAMING_SNAKE_CASE_       ,  shots=1_000	)

			return job.result().get_counts(SCREAMING_SNAKE_CASE_	)


if __name__ == "__main__":
			print(F'''Total count for various states are: {quantum_entanglement(3)}''')




