sorts.counting_sort

This is pure Python implementation of counting sort algorithm For doctests run following command: python -m doctest -v counting_sort.py or python3 -m doctest -v counting_sort.py For manual testing run: python counting_sort.py

Attributes

user_input

Functions

counting_sort(collection)

Pure implementation of counting sort algorithm in Python

counting_sort_string(string)

Module Contents

sorts.counting_sort.counting_sort(collection)

Pure implementation of counting sort algorithm in Python :param collection: some mutable ordered collection with heterogeneous comparable items inside :return: the same collection ordered by ascending Examples: >>> counting_sort([0, 5, 3, 2, 2]) [0, 2, 2, 3, 5] >>> counting_sort([]) [] >>> counting_sort([-2, -5, -45]) [-45, -5, -2]

sorts.counting_sort.counting_sort_string(string)
>>> counting_sort_string("thisisthestring")
'eghhiiinrsssttt'
sorts.counting_sort.user_input