std.sort
The entries of std.sort in the Zig reference. This page has 20 cards.
pub fn argMax(comptime T: type, items: []const T, context: anytype, comptime lessThan: fn (context: @TypeOf(context), lhs: T, rhs: T) bool) ?usize
- Kind
- function
- Module
std.sort
pub fn argMin(comptime T: type, items: []const T, context: anytype, comptime lessThan: fn (@TypeOf(context), lhs: T, rhs: T) bool) ?usize
- Kind
- function
- Module
std.sort
pub 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, {}, asc(u8))`.
- Kind
- function
- Module
std.sort
pub fn binarySearch(comptime T: type, items: []const T, context: anytype, comptime compareFn: fn (@TypeOf(context), T) std.math.Order) ?usize
- Kind
- function
- Module
std.sort
pub fn block(comptime T: type, items: []T, context: anytype, comptime lessThanFn: fn (@TypeOf(context), lhs: T, rhs: T) bool) void
Stable in-place sort.
- Kind
- function
- Module
std.sort
pub 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, {}, desc(u8))`.
- Kind
- function
- Module
std.sort
pub fn equalRange(comptime T: type, items: []const T, context: anytype, comptime compareFn: fn (@TypeOf(context), T) std.math.Order) struct
Returns a tuple of the lower and upper indices in `items` between which all elements return `.eq` when given to `compareFn`.
- Kind
- function
- Module
std.sort
pub fn heap(comptime T: type, items: []T, context: anytype, comptime lessThanFn: fn (@TypeOf(context), lhs: T, rhs: T) bool) void
Unstable in-place sort.
- Kind
- function
- Module
std.sort
pub fn heapContext(a: usize, b: usize, context: anytype) void
Unstable in-place sort.
- Kind
- function
- Module
std.sort
pub fn insertion(comptime T: type, items: []T, context: anytype, comptime lessThanFn: fn (@TypeOf(context), lhs: T, rhs: T) bool) void
Stable in-place sort.
- Kind
- function
- Module
std.sort
pub fn insertionContext(a: usize, b: usize, context: anytype) void
Stable in-place sort.
- Kind
- function
- Module
std.sort
pub fn isSorted(comptime T: type, items: []const T, context: anytype, comptime lessThan: fn (context: @TypeOf(context), lhs: T, rhs: T) bool) bool
- Kind
- function
- Module
std.sort
pub fn lowerBound(comptime T: type, items: []const T, context: anytype, comptime compareFn: fn (@TypeOf(context), T) std.math.Order) usize
Returns the index of the first element in `items` that is greater than or equal to `context`, as determined by `compareFn`.
- Kind
- function
- Module
std.sort
pub fn max(comptime T: type, items: []const T, context: anytype, comptime lessThan: fn (context: @TypeOf(context), lhs: T, rhs: T) bool) ?T
- Kind
- function
- Module
std.sort
pub fn min(comptime T: type, items: []const T, context: anytype, comptime lessThan: fn (context: @TypeOf(context), lhs: T, rhs: T) bool) ?T
- Kind
- function
- Module
std.sort
- Kind
- type
- Module
std.sort
pub fn partitionPoint(comptime T: type, items: []const T, context: anytype, comptime predicate: fn (@TypeOf(context), T) bool) usize
- Kind
- function
- Module
std.sort
pub fn pdq(comptime T: type, items: []T, context: anytype, comptime lessThanFn: fn (context: @TypeOf(context), lhs: T, rhs: T) bool) void
Unstable in-place sort. n best case, n*log(n) worst case and average case. log(n) memory (no allocator required).
- Kind
- function
- Module
std.sort
pub fn pdqContext(a: usize, b: usize, context: anytype) void
Unstable in-place sort.
- Kind
- function
- Module
std.sort
pub fn upperBound(comptime T: type, items: []const T, context: anytype, comptime compareFn: fn (@TypeOf(context), T) std.math.Order) usize
Returns the index of the first element in `items` that is greater than `context`, as determined by `compareFn`.
- Kind
- function
- Module
std.sort