






from __future__ import annotations

def    lowerCAmelCase__		(			_a				:	list[int]			):
		if not list_of_ints:
				return []

		if min(_a			) < 0:
				raise ValueError("All numbers must be positive"			)

		snake_case_ :							Tuple         =				max(len(bin(_a			)[2:]			) for x in list_of_ints			)
		return _msd_radix_sort(_a     ,					_a			)

def    lowerCAmelCase__		(			_a				:	list[int]     ,					_a				:	int			):
		if bit_position == 0 or len(_a			) in [0, 1]:
				return list_of_ints

		snake_case_ :							List[str]         =				[]
		snake_case_ :							Tuple         =				[]
		# Split numbers based on bit at bit_position from the right
		for number in list_of_ints:
				if (number >> (bit_position - 1)) & 1:
						# number has a one at bit bit_position
						ones.append(_a			)
				else:
						# number has a zero at bit bit_position
						zeros.append(_a			)

    # recursively split both lists further
		snake_case_ :							Dict         =				_msd_radix_sort(_a     ,					bit_position - 1			)
		snake_case_ :							Optional[Any]         =				_msd_radix_sort(_a     ,					bit_position - 1			)

		# recombine lists
		snake_case_ :							int         =				zeros
		res.extend(_a			)

		return res

def    lowerCAmelCase__		(			_a				:	list[int]			):
		snake_case_ :							List[Any]         =				len(_a			)
		if not list_of_ints or length == 1:
				return

		if min(_a			) < 0:
				raise ValueError("All numbers must be positive"			)

		snake_case_ :							Tuple         =				max(len(bin(_a			)[2:]			) for x in list_of_ints			)
		_msd_radix_sort_inplace(_a     ,					_a     ,					0     ,					_a			)

def    lowerCAmelCase__		(			_a				:	list[int]     ,					_a				:	int     ,					_a				:	int     ,					_a				:	int			):
		if bit_position == 0 or end_index - begin_index <= 1:
				return

		bit_position -= 1

		snake_case_ :							Any         =				begin_index
		snake_case_ :							Union[str, Any]         =				end_index - 1
		while i <= j:
				snake_case_ :							int         =				False
				if not (list_of_ints[i] >> bit_position) & 1:
						# found zero at the beginning
						i += 1
						snake_case_ :							str         =				True
				if (list_of_ints[j] >> bit_position) & 1:
						# found one at the end
						j -= 1
						snake_case_ :							List[Any]         =				True

				if changed:
						continue

				snake_case_       ,				snake_case_ :							Union[str, Any]         =				list_of_ints[j], list_of_ints[i]
				j -= 1
				if j != i:
						i += 1

		_msd_radix_sort_inplace(_a     ,					_a     ,					_a     ,					_a			)
		_msd_radix_sort_inplace(_a     ,					_a     ,					_a     ,					_a			)


if __name__ == "__main__":
							import doctest

							doctest.testmod()








from __future__ import annotations

def    lowerCAmelCase__		(			_a				:	list[int]     ,					_a				:	int			):
		snake_case_       ,				snake_case_ :							Tuple         =				0, len(_a			) - 1
		while start_ind <= end_ind:
				if array[start_ind] == search_item:
						return start_ind
				elif array[end_ind] == search_item:
						return end_ind
				else:
						start_ind += 1
						end_ind -= 1
    # returns -1 if search_item is not found in array
		return -1


if __name__ == "__main__":
							print(double_linear_search(list(range(1_00)), 40))
