Skip to content

olivif/bloom-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bloom filter

Overview

This is a c++ implementation of a Bloom Filter. You can read more about the implementation details in the bloom-filter blog post series.

Features

// Put an element into the Bloom filter
void put(std::string input);

// Check if the item is present
// If true - the item *might* be present
// If false - the item is definitely not present
bool isMaybePresent(std::string input) const;

Example

// Create the filter
int size = 10000; // the size of the filter - i.e. number of underlying bits used
int k = 3; // the number of hashing functions to use
auto bloomFilter = BloomFilter(size, k);

// Put items in
bloomFilter.put("ABC");
bloomFilter.put("JKDJKD");
bloomFilter.put("UDIG");

// Check if items are present
bool isMaybePresent;

isMaybePresent = bloomFilter.isMaybePresent("ABC");
isMaybePresent = bloomFilter.isMaybePresent("EFG");

Contributing

For any bugs, questions or contributions, start an issue here.

About

Implementing a simple bloom filter in C++.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published