Image for Count-Min Sketch

Count-Min Sketch

Count-Min Sketch is a space-efficient data structure used to estimate how often items appear in a stream of data. Instead of storing every item, it uses multiple hash functions to map items to different counters in a table. When an item is encountered, the counters for its hash positions are increased. To estimate the frequency of an item, you check the counters corresponding to its hashes and take the smallest value, which provides an approximate count. This method allows quick, memory-efficient frequency estimates with some margin of error, useful for large-scale data analysis.