用 Python 实现一个大数据搜索引擎.docVIP

  • 8
  • 0
  • 约7.55千字
  • 约 17页
  • 2018-11-13 发布于江苏
  • 举报
用 Python 实现一个大数据搜索引擎

用 Python 实现一个大数据搜索引擎   when determining if a value is in a set.It can tell you if a value was possibly   added, or if it was definitely not added, but it can’t tell you for certain that   it was added.   ”““   def __init__(self,size):   ”““Setup the BF with the appropriate size”““   self.values = [False] * size   self.size = size   def hash_value(self,value):   ”““Hash the value provided and scale it to fit the BF size”““   returnhash(value) % self.size   def add_value(self,value):   ”““Add a value to the BF”““   h = self.hash_value(value)   self.values[h] = True   def might_contain(self,value

文档评论(0)

1亿VIP精品文档

相关文档