stella v0.4.0 Countingsort

Documentation for Counting sort algorithm. All important informations about counting sort you can find on Wikipedia page.

Annotations

  • n - number of elements in list
  • range of the non-negative key values.

Link to this section Summary

Functions

Sort list

Link to this section Functions

Sort list

  • Normal complexity: O(n)
  • Worst complexity: O(n + k)

Examples

iex> Countingsort.run([4, 1, 3, 5, 2])
[1, 2, 3, 4, 5]