Majority element (source code)

= Majority element
{title2=$2\,\#\{i:A_i=x\}>n$}

An entry occurring strictly more than half the time in a finite <array> or <sequence>. At most one distinct value can satisfy this condition: two such occurrence counts would sum to more than the input length. A <majority element> need not be the smallest, largest or most recently observed entry.