fn pare_down(candidates: &mut Vec<usize>, closure: &BitMatrix) {
    let mut i = 0;
    while i < candidates.len() {
        let candidate_i = candidates[i];
        i += 1;

        let mut j = i;
        let mut dead = 0;
        while j < candidates.len() {
            let candidate_j = candidates[j];
            if closure.contains(candidate_i, candidate_j) {
                // If `i` can reach `j`, then we can remove `j`. So just
                // mark it as dead and move on; subsequent indices will be
                // shifted into its place.
                dead += 1;
            } else {
                candidates[j - dead] = candidate_j;
            }
            j += 1;
        }
        candidates.truncate(j - dead);
    }
}
/// Pare down is used as a step in the LUB computation. It edits the
/// candidates array in place by removing any element j for which
/// there exists an earlier element i<j such that i -> j. That is,
/// after you run `pare_down`, you know that for all elements that
/// remain in candidates, they cannot reach any of the elements that
/// come after them.
///
/// Examples follow. Assume that a -> b -> c and x -> y -> z.
///
/// - Input: `[a, b, x]`. Output: `[a, x]`.
/// - Input: `[b, a, x]`. Output: `[b, a, x]`.
/// - Input: `[a, x, b, y]`. Output: `[a, x]`.
Pare down is used as a step in the LUB computation. It edits the
candidates array in place by removing any element j for which
there exists an earlier element i j. That is,
after you run `pare_down`, you know that for all elements that
remain in candidates, they cannot reach any of the elements that
come after them.

Examples follow. Assume that a -> b -> c and x -> y -> z.


Pare down is used as a step in the LUB computation . It edits the candidates array in place by removing any element j for which there exists an earlier element i j . That is after you run ` pare_down ` you know that for all elements that remain in candidates they cannot reach any of the elements that come after them . Examples follow . Assume that a - > b - > c and x - > y - > z .
fn pare_down(candidates: &mut Vec<usize>, closure: &BitMatrix) {
    let mut i = 0;
    while i < candidates.len() {
        let candidate_i = candidates[i];
        i += 1;
        let mut j = i;
        let mut dead = 0;
        while j < candidates.len() {
            let candidate_j = candidates[j];
            if closure.contains(candidate_i, candidate_j) {
                // If `i` can reach `j`, then we can remove `j`. So just
                // mark it as dead and move on; subsequent indices will be
                // shifted into its place.
                dead += 1;
            } else {
                candidates[j - dead] = candidate_j;
            }
            j += 1;
        }
        candidates.truncate(j - dead);
    }
}
fn pare_down ( candidates : & mut Vec < usize > , closure : & BitMatrix ) { let mut i = 0 ; while i < candidates . len ( ) { let candidate_i = candidates [ i ] ; i += 1 ; let mut j = i ; let mut dead = 0 ; while j < candidates . len ( ) { let candidate_j = candidates [ j ] ; if closure . contains ( candidate_i , candidate_j ) { // If `i` can reach `j`, then we can remove `j`. So just // mark it as dead and move on; subsequent indices will be // shifted into its place. dead += 1 ; } else { candidates [ j - dead ] = candidate_j ; } j += 1 ; } candidates . truncate ( j - dead ) ; } }
Pare down is used as a step in the LUB computation.
Pare down is used as a step in the LUB computation .
candidates
&mut Vec<usize>
closure
&BitMatrix