Hyperloglog, Probability, Hash Function, Cardinality Estimation, Dynamic Programming.
# Case for small cardinalities if n <= 2.5*self.m: z = sum([self.buckets[i] == 0 for i in range(self.m)]) if z != 0: return self.m*math.log(self.m/z) # Case for very large cardinalities elif n > (1/30)*u: return -u*math.log(1-(n/u)) return n There are 1024 buckets and in each bucket we are storing