MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / kth_smallest

Function kth_smallest

src/searching/kth_smallest.rs:7–17  ·  view source on GitHub ↗

Returns k-th smallest element of an array, i.e. its order statistics. Time complexity is O(n^2) in the worst case, but only O(n) on average. It mutates the input, and therefore does not require additional space.

(input: &mut [T], k: usize)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 3

emptyFunction · 0.85
one_elementFunction · 0.85
many_elementsFunction · 0.85

Calls 3

_kth_smallestFunction · 0.85
is_emptyMethod · 0.45
lenMethod · 0.45

Tested by 3

emptyFunction · 0.68
one_elementFunction · 0.68
many_elementsFunction · 0.68