Sorting
The standard library provides utilities for in-place sorting slices. Its basic usage is as follows.
std.sort.asc
and .desc
create a comparison function for the given type at comptime; if non-numerical
types should be sorted, the user must provide their own comparison function.
std.mem.sort
has a best case of O(n), and an average and worst case of O(n*log(n)).