We are given a set of n elements, some of them red, the others blue,
but their colors are hidden. We are to determine the composition of this set,
or to determine an element of the majority color, by making pairwise
comparisons of elements from which we obtain the information "the colors
of these two elements are the same," or "they are different."
Let $\tau_n$, respectively, $\mu_n$, be the optimal average number of
comparisons needed to solve these two problems. We give an explicit
expression of the limit of $\tau_n /n$, respectively, of $\mu_n /n$, in terms
of the probabilities of being red or blue. We also discuss quasi-optimal
algorithms in both cases: when these probabilities are known and when they are
unknown.