在 100000 个元素中查找: list 492 µs | set 72 ns
get('plum') = 4 | 各桶长度: [2, 1, 2, 1] (字符串哈希每次进程启动都随机化,分布会变)
hash(1) == hash(1.0) == hash(True): True → 字典里它们是同一个键: {1: 'c'}
列表不能做键: unhashable type: 'list'
词频 Top2: [('the', 3), ('and', 2)]
按长度分组: {3: ['the', 'cat', 'and', 'the', 'hat', 'and', 'the', 'bat']}
保序去重: ['the', 'cat', 'and', 'hat', 'bat']
核验记录:12_hash_table.txt
与教程配套的原始示例或核验资料,保留完整内容;其中真实用户目录已脱敏,运行范围以记录本身为准。