find the top K most frequent numbers in a data stream
- by Jin
This is more of a data structure question rather than a coding question.
If I am fetching a data stream, i.e, I keep receiving float numbers once at a time, how should I keep track of the top K frequent numbers? Here my memory is 4G and I prefer to have less communication with hard drive unless necessary.
I think heap is good for updating the max and min.
How should I design the data structure? Thanks