数据结构与算法JAVA语言描述第五章部分课后习题参考答案

5.1:

  1. Separate chaining hash table :

  1. Hash table using linear probing :

  1. Hash table using quadratic probing :

  1. Hash table with second hash function h2(x) = 7 – (x mod 7) :

16 and 9 cannot be inserted into the table , because h2(16) is 5 , h2(9) is 5, the table size is 10 , the location 1 , 6 , 4 and 9 have already been inserted.

5.10:

Separate chaining hashing requires the use of links (which requires some memory) and the standard hash method Implement calls to memory allocation routines, which are usually expensive. Linear probing is easy to implement, but due to primary clustering, performance degrades significantly as load factors increase. Quadratic probing is slightly more difficult to implement and performs well in practice. If the table is half empty, the insert may fail, but this is unlikely. Even so, this insertion is true. This is not important, and will almost certainly point out a weakness in the hash function . Double hashing eliminates the primary and secondary clustering, but requires the calculation of a second hash function. And it could be expensive.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值