pub fn bubble_sort<T: PartialOrd + Debug>(v: &mut [T]) {
    for p in 0..v.len() {
        let mut sorted = true;
        for i in 0..(v.len() - 1) - p {
            if v[i] > v[i + 1] {
                v.swap(i, i + 1);
                sorted = false;
            }
        }
        println!("{:?}", v);
        if sorted {
            return;
        };
    }
}
/// simple optimization to quit earlier and not include largest elements, but worst case still O(n^2)
simple optimization to quit earlier and not include largest elements, but worst case still O(n^2)
simple optimization to quit earlier and not include largest elements but worst case still O ( n^2 )
pub fn bubble_sort<T: PartialOrd + Debug>(v: &mut [T]) {
    for p in 0..v.len() {
        let mut sorted = true;
        for i in 0..(v.len() - 1) - p {
            if v[i] > v[i + 1] {
                v.swap(i, i + 1);
                sorted = false;
            }
        }
        println!("{:?}", v);
        if sorted {
            return;
        };
    }
}
pub fn bubble_sort < T : PartialOrd + Debug > ( v : & mut [ T ] ) { for p in 0 .. v . len ( ) { let mut sorted = true ; for i in 0 .. ( v . len ( ) - 1 ) - p { if v [ i ] > v [ i + 1 ] { v . swap ( i , i + 1 ) ; sorted = false ; } } println ! ( " " v ) ; if sorted { return ; } ; } }
simple optimization to quit earlier and not include largest elements, but worst case still O(n^2)
simple optimization to quit earlier and not include largest elements but worst case still O ( n^2 )
v
&mut [T]