Ranged Queries Using Bloom Filters Final
Ranged Queries Using Bloom Filters Final
Basim Baig, Hau Chan, Samuel McCauley, Alice Wong Computer Science Department, Stony Brook University
Goal
Let S be a subset of a universe U (containing strings) that supports the following operations:
Insert(x): S <- S U {x} Query(x, y): Is there a string between x and y?
return No => if nothing between x and y return Yes => if there is a string between x and y with false positive probability (small)
Our Result
C*nk space O(k) time for range queries/inserts An Optimized version that reduces the space to C*nk/log(k) while retaining the same query time
Idea
Let S = B be our bloom filter structure. For each insert(K), K in U, we insert each substring/prefix of K[0, pi], i=1,, |K|/p, we insert it into B. (We assume that |K| is divisible by p.)
Space Analysis
The size of the structure would be the number of inserted strings, say N, times the number of inserts requires to insert the string with the maximum length. Suppose the maximum length of the string inserted is K, then we insert K/p times for this particular string. We need at most O(NK/p) inserts to the bloom filter.
Space:
Query Analysis
Since bloom filter has look up time of O(1), we need to look up at most all the brute force elements at each level Hence, the range query time of our structure is:
Error analysis:
You can set the appropriate value of error that you desire. But less error means you need more space. However this does not impact the space as much as you would think. The dominant factor in the space is still the k/p factor outside the log.
Optimization
Instead of brute forcing down each of the paths that matches the input range strings we will just brute force selected nodes.
Modified costs
Query cost:
Space cost:
Thank you