The <a href="https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_majority_vote_algorithm" class="extiw" title="en:Boyer–Moore majority vote algorithm">Boyer–Moore majority vote algorithm</a>. The input to the algorithm is shown along the bottom of the figure, and the algorithm's state (a single input value and counter) is shown as the sequence of symbols and their heights along the black curve.
<a href="//commons.wikimedia.org/wiki/User:David_Eppstein" class="mw-redirect" title="User:David Eppstein">David Eppstein</a>
<span class="int-own-work" lang="en">Own work</span>