




"""simple docstring"""
# Algorithm for the pigeonhole sorting







def 						UpperCAmelCase				(			A__:    Optional[Any]     )  ->     List[Any]:
			__lowerCamelCase					:	Any	       =				min(A__     )  # min() finds the minimum value
			__lowerCamelCase					:	Tuple	       =				max(A__     )  # max() finds the maximum value

			__lowerCamelCase					:	Optional[Any]	       =				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
			__lowerCamelCase					:	Dict	       =				[0] * size

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

			# Putting the elements back into the array in an order.
			__lowerCamelCase					:	List[str]	       =				0
			for count in range(A__     ):
						while holes[count] > 0:
									holes[count] -= 1
									__lowerCamelCase					:	Optional[Any]	       =				count + min_val
									i += 1





def 						UpperCAmelCase				(			)  ->     Union[str, Any]:
			__lowerCamelCase					:	Optional[int]	       =				[8, 3, 2, 7, 4, 6, 8]
			pigeonhole_sort(A__     )
			print('Sorted order is:'							,				' '.join(A__     )     )


if __name__ == "__main__":
					main()









"""simple docstring"""
from cva import destroyAllWindows, imread, imshow, waitKey





def 						UpperCAmelCase				(			A__:    Tuple     )  ->     Union[str, Any]:
			# getting number of pixels in the image
			__lowerCamelCase       ,      __lowerCamelCase					:	Optional[Any]	       =				img.shape[0], img.shape[1]

			# converting each pixel's color to its negative
			for i in range(A__     ):
						for j in range(A__     ):
									__lowerCamelCase					:	Optional[Any]	       =				[255, 255, 255] - img[i][j]

			return img


if __name__ == "__main__":
					# read original image
					a_				:    Dict										=     imread('''image_data/lena.jpg''', 1)

					# convert to its negative
					a_				:    str										=     convert_to_negative(img)

					# show result image
					imshow('''negative of original image''', img)
					waitKey(0)
					destroyAllWindows()



