时空权衡——哈希法(Time/Space Tradeoff - Hashing)

本文介绍了哈希法作为实现字典抽象数据类型的基本方法,包括哈希函数、碰撞处理(如分离链接、线性探测和双哈希)以及Rabin-Karp字符串搜索算法。哈希法适用于处理大量键的信息检索应用。
摘要由CSDN通过智能技术生成

时空权衡——哈希法(Time/Space Tradeoff - Hashing)


哈希法简介(Introduction)
Hashing is a standard way of implementing the abstract data type “dictionary”, which is a set with the operations of searching, insertion, deletion, initialisation and rehashing. The elements of this set can be anything, such as numbers, characters, character strings, etc.

The element above is called the key. Hashing is based on this idea of distributing keys among a one-dimensional array H[0..m-1] called a hash table. The method for the distribution is called hash function. The function assigns an integer between 1 to m, called hash address, to a key. e.g. h: key -> {1..m}

哈希函数(Hash Function)
If keys are integers and the size of a hash table is m, we can denote h(n) = n mod m. Actually, the has

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值