# Count-min sketch

I don't understand the use case of count min sketch. Based on Count–min sketch, it says "serves as a frequency table of events in a stream of data.".

If I know there are N types of events, why can't I just allocate an array of N slots or a hashmap to keep track of the event frequencies as the stream is ingested?

Am I right to say the use case is when N is unknown or N is so large that it is not possible to keep the entire frequency array/hashmap in memory?

Yes, the use case is $$N$$ so large that the entire table would not fit in the main memory. For example, imagine that every event is tied to an IPv6 address. IPv6 uses 128 bits for each address, so you would in principle need an array with $$2^{128}$$ elements.