competitive-programming-lib 0.1.0

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