本文主要是介绍Lintcode 556 · Standard Bloom Filter [Python],希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
没有remove过程
class StandardBloomFilter:"""@param: k: An integer"""def __init__(self, k):# do intialization if necessaryself.dic = collections.defaultdict(int)"""@param: word: A string@return: nothing"""def add(self, word):# write your code hereself.dic[word] += 1"""@param: word: A string@return: True if contains word"""def contains(self, word):# write your code hereif self.dic[word] >= 1:return Truereturn False
这篇关于Lintcode 556 · Standard Bloom Filter [Python]的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!