Data structures · Flashcard

How can you track exactly which of 100 million users were active each day, in little memory?

medium Estimation

Answer

A bitmap per day, with bit n set when user n is active: 100 million bits is 12.5 MB. "Active on both days" is a bitwise AND, "either day" an OR, and counts are exact, unlike HyperLogLog. It needs small, dense integer ids; sparse ids call for compressed bitmaps such as Roaring.

Review this in your daily deck All cards in Data structures