Skip to content

Commit

Permalink
Update week1-07-sst-optimizations.md (#49)
Browse files Browse the repository at this point in the history
The description has been changed to:

1. Display two separate has functions results as `hash1` and `hash2`.
2. Correctly state the bloom filter has 7 bits
3. Add a link to a post explaining bloom filters
  • Loading branch information
redixhumayun authored Feb 24, 2024
1 parent 30cdeb1 commit ce9ef62
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mini-lsm-book/src/week1-07-sst-optimizations.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ Bloom filters are probabilistic data structures that maintains a set of keys. Yo

You usually need to have a hash function in order to construct a bloom filter, and a key can have multiple hashes. Let us take a look at the below example. Assume that we already have hashes of some keys and the bloom filter has 7 bits.

[Note: If you want to understand bloom filters better, look [here](https://samwho.dev/bloom-filters/)]

```plaintext
hash1 = ((character - a) * 13) % 7
hash1 = ((character - a) * 11) % 7
hash2 = ((character - a) * 11) % 7
b -> 6 4
c -> 5 1
d -> 4 5
Expand All @@ -34,7 +36,7 @@ g -> 1 3
h -> 0 0
```

If we insert b, c, d into the 6-bit bloom filter, we will get:
If we insert b, c, d into the 7-bit bloom filter, we will get:

```
bit 0123456
Expand Down

0 comments on commit ce9ef62

Please sign in to comment.