Counting

This algorithm approximates the number of unique items (cardinality) of a multiset. This is achieved by using a hash function that is applied to every element that is to be counted. The algorithm observes the maximum number of leading zeros that occur for all hash values, where intuitively hash values with more leading zeros are less likely and indicate a larger cardinality.


Inputs

Insert 1,000,000 random records with a given cardinality of...

Precision

Smaller will give a worse estimate

less error, more memory → ←greater error, less memory
10

Result

Estimate (EE) NaN (NaN% error)
Registers (mm) The number of registers used.
Memory used NaN bytes

Calculation

The cardinality (EE) is estimated by the formula amm2Za_m m^2 Z

ama_m A constant used to correct a systematic multiplicative bias
m2m^2 NaN The number of registers (mm) squared
ZZ The harmonic mean of the registers