I remember hearing about the following algorithm some years back, but can\'t find any reference to it online. It identifies the top k elements (or heavy hitters) in a dat
You are talking about the notable Misra-Gries Algorithm, and Space-Saving Algorithm is a faster version of Misra-Gries Algorithm. Please check this lecture note for detail Streaming Algorithm Dartmouth sec 1.2.
One thing I want to point out is that this algorithm does not give you the top-k elements if you only used k counters, instead, it gives all elements with frequency > m / k, where m is the total length of the data stream.
Detailed analysis can be found in the lecture notes I attached.