fn block(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(n*log(n)) worst case and average case. O(1) memory (no allocator required). Sorts in ascending order with respect to the given lessThan function.

NOTE: the algorithm only work when the comparison is less-than or greater-than (See https://github.com/ziglang/zig/issues/8289)

Parameters

T: type,
items: []T,
context: anytype,
lessThanFn: fn (@TypeOf(context), T, T) bool,