Perfect hashing (And Minimal perfect hashing)

本文介绍了完美哈希的概念及其在哈希表查找中的应用。完美哈希是一种注入式的哈希函数,能确保每个有效输入映射到不同的哈希值,实现直接定位而无需额外搜索。此外还探讨了最小完美哈希,这是一种范围由连续整数组成的完美哈希函数,能够提供紧凑的哈希表结构,没有空闲槽位。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Perfect Hashing:

A hash function that is injective—that is, maps each valid input to a different hash value—is said to be perfect. 

With such a function one can directly locate the desired entry in a hash table, without any additional searching. 


Minimal perfect Hashing:

A perfect hash function for n keys is said to be minimal if its range consists of n consecutive integers, usually from 0 to n−1. Besides providing single-step lookup, a minimal perfect hash function also yields a compact hash table, without any vacant slots. Minimal perfect hash functions are much harder to find than perfect ones with a wider range.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值