fn partition<T: PartialOrd>(elements: &mut [T]) -> usize {
    // Explictly set the pivot to the lowest element
    let mut i : usize;
    let mut j : usize;

    if elements.is_empty() {
        return 0;
    }

    let high = elements.len();

    i = 0;
    j = high - 1;

    while i < j {
        while elements[i] <= elements[0] && i < (high-1) { i += 1; } // Bounds 2
        while elements[j] >= elements[0] && j > 0 { j -= 1; } // Bounds 3
        
        if i >= j {break; } // Bounds 4
        
        elements.swap(i, j); // Check 5
    }
    elements.swap(0, j); // Check 6
    j
}
/// Quicksort
/// Simple sort algorithm that is type aware and is unique in that it's test driven
/// 
Quicksort
Simple sort algorithm that is type aware and is unique in that it's test driven
Quicksort Simple sort algorithm that is type aware and is unique in that it ' s test driven
fn partition<T: PartialOrd>(elements: &mut [T]) -> usize {
    // Explictly set the pivot to the lowest element
    let mut i : usize;
    let mut j : usize;
    if elements.is_empty() {
        return 0;
    }
    let high = elements.len();
    i = 0;
    j = high - 1;
    while i < j {
        while elements[i] <= elements[0] && i < (high-1) { i += 1; } // Bounds 2
        while elements[j] >= elements[0] && j > 0 { j -= 1; } // Bounds 3
        if i >= j {break; } // Bounds 4
        elements.swap(i, j); // Check 5
    }
    elements.swap(0, j); // Check 6
    j
}
fn partition < T : PartialOrd > ( elements : & mut [ T ] ) -> usize { // Explictly set the pivot to the lowest element let mut i : usize ; let mut j : usize ; if elements . is_empty ( ) { return 0 ; } let high = elements . len ( ) ; i = 0 ; j = high - 1 ; while i < j { while elements [ i ] <= elements [ 0 ] && i < ( high - 1 ) { i += 1 ; } // Bounds 2 while elements [ j ] >= elements [ 0 ] && j > 0 { j -= 1 ; } // Bounds 3 if i >= j { break ; } // Bounds 4 elements . swap ( i , j ) ; // Check 5 } elements . swap ( 0 , j ) ; // Check 6 j }
Quicksort
Simple sort algorithm that is type aware and is unique in that it's test driven
Quicksort Simple sort algorithm that is type aware and is unique in that it ' s test driven
elements
&mut [T]
elements
&mut [T]