Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
BloomFilter&Hashing
BarnaSaha
BloomFilter
• ChecksforSETMEMBERSHIPefficiently
Iselementxintheset?
MoAvaAngExample
• SpamFiltering
Ø Wehaveasetof1billionemailaddressesthatweconsidertobenon-spam.Ø Eachstreamelementisoftheform(emailaddress,email).Ø BeforeaccepAngtheemail,amail-clientneedstocheckifthisaddressbelongstosetS.Ø Eachtypicalemailaddressrequires20bytesofstoragewhereasinthemainmemoryweonlyhavesay1billionbyte(roughly1Gigabyte),or8billionbits.Ø Wecannotstoreallthevalidemailaddressesinthemain
memory.
MoAvaAngExample
• SpamFiltering– Allvalidemailsmustbedelivered– Numberofspamemailsdeliveredshouldbeaslowaspossible
BloomFilter
BloomFilter
AnalysisofBloomFilter
AnalysisofBloomFilter
SpamFilteringExample
• Wehave
OpAmumValueofk
• AsthenumberofhashfuncAonsincrease,higheristhechanceoffindinga0bitcell
• AlsowithincreasingnumberofhashfuncAons,thenumberofcellswith0bitsdecreases
• OpAmumvalueobtainedbydifferenAaAon
ApplicaAonsofBloomFilter
• BloomFilterhasfoundinnumerableapplicaAonsinnetworkingandwebtechnology
AnalysisofBloomFilter
AnalysisusesfullyrandomhashfuncAons—difficulttoobtainwithhighspaceandcompuAngrequirements
Strongly2-wiseUniversalHashFuncAon
• MappingsetofkeysU=[0,1,2,…,m-1]torangeR=[0,1,2,…,n-1]– H={ha,b=[(ax+b)modp]modn}
• p>=misaprime,1<=a<=p-1,0<=b<=p-1• Easytocomputeandstore:O(1)• SaAsfies(almost)forall,
Strongly3-wiseUniversalHashFuncAon
• MappingsetofkeysU=[0,1,2,…,m-1]torangeR=[0,1,2,…,n-1]– H={ha,b=[(ax2+bx+c)modp]modn}
• p>=misaprime,1<=a<=p-1,0<=b,c<=p-1• Easytocomputeandstore:O(1)• SaAsfies(almost)
• MappingsetofkeysU=[0,1,2,…,p-1]torangeR=[0,1,2,…,p-1]– H={ha,b=(ax+b)modp},0<=a,b<=p-1
• Fix.– Whatis?– NumberofhashfuncAons– NumberofsoluAonsfor“a”and“b”=1
Strongly2-Universal