Hyperloglog, Probability, Hash Function, Cardinality Estimation, Dynamic Programming.
range(10*k): h = random.sample(data, 1)[0] hsh = mmh3.hash(h, 42, signed=False) & ((1<<N)-1) # First p bits is for bucket index r # Remaining N-p bits are for finding the cardinality u = N-p r = hsh >> u q = hsh & ((1<<u)-1) # number of leading zeros in binary of quotient q above b =