toolbox-rs 0.6.0

A toolbox of basic data structures and algorithms
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use rand::{Rng, distr::StandardUniform};
use toolbox_rs::rdx_sort::Sort;

fn main() {
    let rng = rand::rng();
    let mut input: Vec<f64> = rng.sample_iter(StandardUniform).take(100_000).collect();

    let is_sorted = input.windows(2).all(|i| i[0] < i[1]);
    println!("before, is_sorted={is_sorted}");

    input.rdx_sort();

    let is_sorted = input.windows(2).all(|i| i[0] < i[1]);
    println!("after, is_sorted={is_sorted}");
}