Analysis of Boyer and Moore's MJRTY algorithm
Résumé
Given a set of $n$ elements each of which is either red or blue, Boyer and Moore's MJRTY algorithm uses pairwise equal/not equal color comparison to determine the majority color. We analyze the average behavior of their algorithm, proving that if all $2^n$ possible inputs are equally likely, the average number of color comparisons used is $n-\sqrt{2n/\pi} + O(1)$ with variance $(\pi-2)n/\pi - \sqrt{2n/\pi} + O(1)$.
Domaines
Complexité [cs.CC]Origine | Fichiers produits par l'(les) auteur(s) |
---|