The Boyer–Moore majority vote algorithm. 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.
Own work
David Eppstein