






# Algorithm for the pigeonhole sorting







def 				snake_case  (     lowerCamelCase					):




	'''simple docstring'''







	__lowercase             =  min(lowerCamelCase					)  # min() finds the minimum value
	__lowercase             =  max(lowerCamelCase					)  # max() finds the maximum value

	__lowercase             =  max_val - min_val + 1  # size is difference of max and min values plus one

	# list of pigeonholes of size equal to the variable size
	__lowercase             =  [0] * size

	# Populate the pigeonholes.
	for x in a:
		assert isinstance(lowerCamelCase				,  lowerCamelCase					), "integers only please"
		holes[x - min_val] += 1

	# Putting the elements back into the array in an order.
	__lowercase             =  0
	for count in range(lowerCamelCase					):
		while holes[count] > 0:
			holes[count] -= 1
			__lowercase             =  count + min_val
			i += 1





def 				snake_case  (     ):




	'''simple docstring'''







	__lowercase             =  [8, 3, 2, 7, 4, 6, 8]
	pigeonhole_sort(lowerCamelCase					)
	print("""Sorted order is:"""				,  """ """.join(lowerCamelCase					)					)


if __name__ == "__main__":
						main()









from __future__ import annotations





def 				snake_case  (     lowerCamelCase					):




	'''simple docstring'''







	if not nums:
		return 0
	__lowercase             =  nums[0]
	__lowercase             =  0
	for num in nums[1:]:
		__lowercase       ,						__lowercase             =  (
		    max_excluding + num,
		    max(lowerCamelCase				,  lowerCamelCase					),
		)
	return max(lowerCamelCase				,  lowerCamelCase					)


if __name__ == "__main__":
						import doctest

						doctest.testmod()

