

# Algorithm for the pigeonhole sorting








def        __lowerCAmelCase    (       _UpperCamelCase		:  str	)		->							Union[str, Any]:
 '''simple docstring'''


 SCREAMING_SNAKE_CASE								=			min(_A	)  # min() finds the minimum value
 SCREAMING_SNAKE_CASE								=			max(_A	)  # max() finds the maximum value

 SCREAMING_SNAKE_CASE								=			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
 SCREAMING_SNAKE_CASE								=			[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.
 SCREAMING_SNAKE_CASE								=			0
 for count in range(_A	):
  while holes[count] > 0:
   holes[count] -= 1
   SCREAMING_SNAKE_CASE								=			count + min_val
   i += 1


def        __lowerCAmelCase    (       )		->							Union[str, Any]:
 '''simple docstring'''


 SCREAMING_SNAKE_CASE								=			[8, 3, 2, 7, 4, 6, 8]
 pigeonhole_sort(_A	)
 print('Sorted order is:'		,							' '.join(_A	)	)


if __name__ == "__main__":
      main()




import numpy as np


def        __lowerCAmelCase    (       _UpperCamelCase		:  np.ndarray	)		->							np.ndarray:
 '''simple docstring'''


 return 1 / (1 + np.exp(-vector	))


def        __lowerCAmelCase    (       _UpperCamelCase		:  np.ndarray	)		->							np.ndarray:
 '''simple docstring'''


 return vector * sigmoid(_UpperCamelCase	)


if __name__ == "__main__":
      import doctest

      doctest.testmod()

