当前位置:   article > 正文

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

数据结构与算法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.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/640663
推荐阅读
相关标签
  

闽ICP备14008679号