NumEx v0.1.0 Sort View Source

A module to sort enumerables.

Link to this section Summary

Functions

Takes a two enumerables and performs Lexographic sort operations

Return a sorted copy of an Enumerable sorted along one axis only

Takes a list of elements and sorts the elements in quick sort fashion

Return a sorted copy of a List of Lists based on the value of axis

Link to this section Functions

Link to this function lexsort(list1, list2) View Source
lexsort(list(), list()) :: list()

Takes a two enumerables and performs Lexographic sort operations.

Examples

iex> Sort.lexsort([5, 3, 6, 8, 1], [0, 9, 4, 7, 2])
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Link to this function msort(list) View Source
msort(list()) :: list()

Return a sorted copy of an Enumerable sorted along one axis only

Examples

iex> Sort.msort([[3, 4], [0, 1], [6, 5]])
[[0, 1], [3, 4], [5, 6]]
Link to this function quicksort(list) View Source
quicksort([]) :: []
quicksort(list()) :: list()

Takes a list of elements and sorts the elements in quick sort fashion.

Examples

iex>  Sort.quicksort([195,99,78,12])
 [12, 78, 99, 195]]
Link to this function sort(list, axis) View Source
sort(list(), [integer()]) :: [[integer()]]

Return a sorted copy of a List of Lists based on the value of axis

Examples

iex> Sort.sort([[6, 2], [5, 7], [0, 9]], 1)
[[2, 6], [5, 7], [0, 9]]
iex> Sort.sort([[6, 2], [5, 7], [1, 3]], 0)
[[1, 2], [3, 5], [6, 7]]