pub fn learned_sort<T>(arr: &mut [T])Expand description
Sorts a slice using the Learned Partition Sort algorithm.
This algorithm achieves O(N) complexity on well-distributed numerical data by learning the data distribution and using it to directly calculate element positions.
§Algorithm
- For small inputs (< 8192 elements), falls back to
sort_unstable - Samples data to find min/max bounds
- Distributes elements to buckets based on calculated positions
- Sorts each bucket in parallel using Rayon
§Examples
use learned_partition_sort::learned_sort;
let mut data: Vec<i64> = vec![5, 2, 8, 1, 9];
learned_sort(&mut data);
assert_eq!(data, vec![1, 2, 5, 8, 9]);