competitive-programming-lib 0.1.0

Competitive Programming Library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
pub fn selection_sort(arr: &mut [i32]) {
    let n = arr.len();
    for i in 0..n - 1 {
        let mut min_index = i;
        for j in i + 1..n {
            if arr[j] < arr[min_index] {
                min_index = j;
            }
        }
        arr.swap(i, min_index);
    }
}