22 cout <<
"Aleph-w Cuckoo Filter Example" <<
endl;
23 cout <<
"=============================" <<
endl <<
endl;
30 vector<string> items = {
"apple",
"banana",
"cherry",
"date",
"elderberry"};
32 cout <<
"Inserting items: ";
33 for (
const auto& item : items) {
39 cout <<
"Filter size: " <<
filter.size() <<
endl;
40 cout <<
"Load factor: " << fixed << setprecision(4) <<
filter.load_factor() <<
endl <<
endl;
43 cout <<
"Checking membership:" <<
endl;
45 for (
const auto& query :
queries) {
46 cout <<
" - " << setw(10) << query <<
": "
47 << (
filter.contains(query) ?
"LIKELY PRESENT" :
"DEFINITELY ABSENT") <<
endl;
52 cout <<
"Removing 'banana'..." <<
endl;
53 if (
filter.remove(
"banana")) {
54 cout <<
"'banana' was removed successfully." <<
endl;
57 cout <<
"Checking 'banana' again: "
58 << (
filter.contains(
"banana") ?
"LIKELY PRESENT" :
"DEFINITELY ABSENT") <<
endl;
59 cout <<
"Filter size after removal: " <<
filter.size() <<
endl <<
endl;
62 cout <<
"Filling the filter with more items..." <<
endl;
63 for (
int i = 0; i < 800; ++i) {
67 cout <<
"Final filter size: " <<
filter.size() <<
endl;
68 cout <<
"Final load factor: " << fixed << setprecision(4) <<
filter.load_factor() <<
endl;
70 if (
filter.load_factor() > 0.8) {
71 cout <<
"Notice high load factor supported by Cuckoo Filter!" <<
endl;
Industrial-grade Cuckoo Filter implementation.
Probabilistic set membership with Cuckoo filters.
Main namespace for Aleph-w library functions.
Container2< typename Container1::Item_Type > filter(Container1 &container, Operation &operation)
Filter elements that satisfy operation.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
std::string to_string(const time_t t, const std::string &format)
Format a time_t value into a string using format.