stella v0.6.0 Countingsort
Documentation for Counting sort
algorithm. All important
informations about counting sort you can find at
Wikipedia page.
Annotations
- n - number of elements in list
- range of the non-negative key values.
Link to this section Summary
Link to this section Functions
Link to this function
run(list)
Specs
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]
iex> Countingsort.run([1, 2, 4, 3])
[1, 2, 3, 4]