





# Algorithm for the pigeonhole sorting






def     SCREAMING_SNAKE_CASE			(      lowerCAmelCase					):
       _UpperCamelCase           =						min(lowerCamelCase__					)  # min() finds the minimum value
       _UpperCamelCase           =						max(lowerCamelCase__					)  # max() finds the maximum value

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


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


if __name__ == "__main__":
       main()













from __future__ import annotations

from collections.abc import Iterator

class  __A:

     def __init__(      self,       A      ):





            """simple docstring"""

            _UpperCamelCase              =						value
            _UpperCamelCase              =						None
            _UpperCamelCase              =						None






class  __A:

     def __init__(      self,       A      ):





            """simple docstring"""

            _UpperCamelCase              =						tree

     def 	_UpperCamelCase     (      self,       A      ):





            """simple docstring"""

            if node is None:
                   return 0
            return node.value + (
                self.depth_first_search(node.left      ) + self.depth_first_search(node.right      )
            )



     def __iter__(      self      ):





            """simple docstring"""

            yield self.depth_first_search(self.tree      )


if __name__ == "__main__":
       import doctest

       doctest.testmod()






