python - 什么是不存储键的 Python 哈希表/字典实现?

标签 python dictionary map hashtable data-structures

我在哈希表中存储数百万,可能数十亿个 4 字节值,我不想存储任何键。我希望只需要存储键和值的哈希值。这必须很快并且全部保存在 RAM 中。与 set() 不同的是,仍将使用 key 查找条目。

这个在 Python 中的实现是什么?这个有名字吗?

是的,碰撞是允许的,可以忽略。

(我可以为冲突做一个异常(exception),可以为那些存储 key 。或者,冲突可以只覆盖以前存储的值。)

最佳答案

Bloomier filters - 节省空间的关联数组

来自维基百科:

Chazelle et al. (2004) designed a generalization of Bloom filters that could associate a value with each element that had been inserted, implementing an associative array. Like Bloom filters, these structures achieve a small space overhead by accepting a small probability of false positives. In the case of "Bloomier filters", a false positive is defined as returning a result when the key is not in the map. The map will never return the wrong value for a key that is in the map.

关于python - 什么是不存储键的 Python 哈希表/字典实现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1918456/

相关文章:

python - 如何在 python 中的双花括号内抓取特定数据

python - 广度优先搜索 : how to get currency exchange?

Python:HTTP 发布带有流式传输的大文件

python - AWS Elastic Beanstalk 使用 Python 2 和 Python 3 出错?

python - 将 DataFrame 转换为字典的字典

c++ - 强制 std::map 的键类型不是 const

android - 当我将 map 放入 Scrollview 时,它会水平移动但不能垂直移动

javascript - 如何在 leaflet.js 中使用动画 gif 磁贴

ios - 如何从 ios 10 中的 FBGraphApi 结果中提取数据

将自定义类作为第二种类型的 C++ STL 映射