Skip to main content

majority_candidate

Function majority_candidate 

Source
pub fn majority_candidate<T: MajorityKey>(
    values: &[T],
    validity: &Mask,
) -> Option<T>
Expand description

Runs a Boyer–Moore vote over the valid values and returns its candidate.

The candidate is the value filling more than half of the valid positions whenever there is one. Otherwise it is some valid value; callers that need to know which case they have count it, for example with an equality comparison. validity must have the same length as values. Returns None only when no position is valid.