16 releases (8 breaking)

0.8.5 Jul 12, 2021
0.8.2 Apr 17, 2021
0.1.0 May 21, 2020
0.0.4 Nov 22, 2014

#3 in #quick-sort

Download history 32/week @ 2024-06-15 49/week @ 2024-06-22 11/week @ 2024-06-29 10/week @ 2024-07-06 23/week @ 2024-07-13 22/week @ 2024-07-20 139/week @ 2024-07-27 33/week @ 2024-08-03 26/week @ 2024-08-10 13/week @ 2024-08-17 17/week @ 2024-08-24 19/week @ 2024-08-31 8/week @ 2024-09-07 9/week @ 2024-09-14 22/week @ 2024-09-21 178/week @ 2024-09-28

219 downloads per month
Used in 3 crates

MIT/Apache

13KB
374 lines

rust-sort

sort algorithms

exchange sorts

bubble sort

extern crate sort;

use sort::bubble_sort;

fn main() {
    let mut data = vec![5, 4, 3, 2, 1];
    bubble_sort(&mut data);
    assert_eq!(data, [1, 2, 3, 4, 5]);
}

quicksort

extern crate sort;

use sort::quicksort;

fn main() {
    let mut data = vec![5, 4, 3, 2, 1];
    quicksort(&mut data);
    assert_eq!(data, [1, 2, 3, 4, 5]);
}

selection sorts

selection sort

extern crate sort;

use sort::selection_sort;

fn main() {
    let mut data = vec![5, 4, 3, 2, 1];
    selection_sort(&mut data);
    assert_eq!(data, [1, 2, 3, 4, 5]);
}

heapsort

extern crate sort;

use sort::heapsort;

fn main() {
    let mut data = vec![5, 4, 3, 2, 1];
    heapsort(&mut data);
    assert_eq!(data, [1, 2, 3, 4, 5]);
}

insertion sorts

insertion sort

extern crate sort;

use sort::insertion_sort;

fn main() {
    let mut data = vec![5, 4, 3, 2, 1];
    insertion_sort(&mut data);
    assert_eq!(data, [1, 2, 3, 4, 5]);
}

merge sorts

merge sort

extern crate sort;

use sort::merge_sort;

fn main() {
    let mut data = vec![5, 4, 3, 2, 1];
    let result = merge_sort(&mut data);
    assert_eq!(result, [1, 2, 3, 4, 5]);
}

hybrid sorts

introsort

extern crate sort;

use sort::introsort;

fn main() {
    let mut data = vec![5, 4, 3, 2, 1];
    introsort(&mut data);
    assert_eq!(data, [1, 2, 3, 4, 5]);
}

No runtime deps