-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
32 lines (25 loc) · 1.01 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <string>
#include "BloomFilter.hpp"
#define SIZE 4
using namespace std;
int main(){
BloomFilter<std::string> filter(SIZE);
filter.insert("have");
filter.insert("you");
filter.insert("rain");
//Those are for sure
cout << "'have' can be in the set? : " << filter.contains("have") << endl;
cout << "'you' can be in the set? : " << filter.contains("you") << endl;
cout << "'rain' can be in the set? : " << filter.contains("rain") << endl << endl;
//Those are not
cout << "False positives probability: " << filter.getFalseRate() << endl;
cout <<"'ever' can be in the set? : " << filter.contains("ever") << endl;
cout <<"'seen' can be in the set? : " << filter.contains("seen") << endl << endl;
//Let's resize to reduce false positives
filter.resize(15);
cout << "False positives probability: " << filter.getFalseRate() << endl;
cout <<"'ever' can be in the set? : " << filter.contains("ever") << endl;
cout <<"'seen' can be in the set? : " << filter.contains("seen") << endl;
return 0;
}