Functions
fn argMax(comptime T: type, items: []const T, context: anytype, comptime lessThan: fn (@TypeOf(context), T, T) bool) ?usize
No documentation provided.
fn argMin(comptime T: type, items: []const T, context: anytype, comptime lessThan: fn (@TypeOf(context), T, T) bool) ?usize
No documentation provided.
fn asc(comptime T: type) (fn (void, T, T) bool)
Use to generate a comparator function for a given type. e.g. `sort(u8, slice, {}…
Use to generate a comparator function for a given type. e.g.
sort(u8, slice, {}, asc(u8))
.fn binarySearch(comptime T: type, key: anytype, items: []const T, context: anytype, comptime compareFn: fn (@TypeOf(context), @TypeOf(key), T) math.Order) ?usize
No documentation provided.
fn block(comptime T: type, items: []T, context: anytype, comptime lessThanFn: fn (@TypeOf(context), T, T) bool) void
No documentation provided.
fn desc(comptime T: type) (fn (void, T, T) bool)
Use to generate a comparator function for a given type. e.g. `sort(u8, slice, {}…
Use to generate a comparator function for a given type. e.g.
sort(u8, slice, {}, desc(u8))
.fn heap(comptime T: type, items: []T, context: anytype, comptime lessThanFn: fn (@TypeOf(context), T, T) bool) void
Unstable in-place sort. O(n*log(n)) best case, worst case and average case. O(1…
Unstable in-place sort. O(n*log(n)) best case, worst case and average case. O(1) memory (no allocator required). Sorts in ascending order with respect to the given
lessThan
function.fn heapContext(a: usize, b: usize, context: anytype) void
Unstable in-place sort. O(n*log(n)) best case, worst case and average case. O(1…
Unstable in-place sort. O(n*log(n)) best case, worst case and average case. O(1) memory (no allocator required).
context
must have methodsswap
andlessThan
, which each take 2usize
parameters indicating the index of an item. Sorts in ascending order with respect tolessThan
.fn insertion(comptime T: type, items: []T, context: anytype, comptime lessThanFn: fn (@TypeOf(context), T, T) bool) void
Stable in-place sort. O(n) best case, O(pow(n, 2)) worst case. O(1) memory (no …
Stable in-place sort. O(n) best case, O(pow(n, 2)) worst case. O(1) memory (no allocator required). Sorts in ascending order with respect to the given
lessThan
function.fn insertionContext(a: usize, b: usize, context: anytype) void
Stable in-place sort. O(n) best case, O(pow(n, 2)) worst case. O(1) memory (no …
Stable in-place sort. O(n) best case, O(pow(n, 2)) worst case. O(1) memory (no allocator required).
context
must have methodsswap
andlessThan
, which each take 2usize
parameters indicating the index of an item. Sorts in ascending order with respect tolessThan
.fn isSorted(comptime T: type, items: []const T, context: anytype, comptime lessThan: fn (@TypeOf(context), T, T) bool) bool
No documentation provided.
fn max(comptime T: type, items: []const T, context: anytype, comptime lessThan: fn (@TypeOf(context), T, T) bool) ?T
No documentation provided.
fn min(comptime T: type, items: []const T, context: anytype, comptime lessThan: fn (@TypeOf(context), T, T) bool) ?T
No documentation provided.
fn pdq(comptime T: type, items: []T, context: anytype, comptime lessThanFn: fn (@TypeOf(context), T, T) bool) void
No documentation provided.