Hyperloglog, Probability, Hash Function, Cardinality Estimation, Dynamic Programming.
[-1]*self.m self.alpha = 0.7213/(1+1.079/self.m) if self.m == 16: self.alpha = 0.673 elif self.m == 32: self.alpha = 0.697 elif self.m == 64: self.alpha = 0.709 def add(self, data): h = mmh3.hash(data, 42, signed=False) & ((1<<self.N)-1) # Exclude the 1st p bits in h v = self.N-self.p # Quotient