Hyperloglog, Probability, Hash Function, Cardinality Estimation, Dynamic Programming.
''.join(\ random.choices(string.ascii_lowercase + string.digits, k=random.randint(1, 20))) # generate hash between 0 and 2^N-1 hsh = mmh3.hash(data, 42, signed=False) & ((1<<N)-1) # number of trailing zeros in binary of hsh b = get_trailing_zeros(hsh, N) g = max(g, b) # calculate cardinality a +=