CISC 235 Lecture Notes - Lecture 14: Donald Knuth, American Broadcasting Company

48 views3 pages

Document Summary

In most of our examples we used h(k) = k % m. this may not be a good choice. A well-designed hash function should try to incorporate all the information in the key - when we use something as simple as k % m we are potentially throwing away most of the information. For example if m = 100, the key values 16 and. 34324392316 will both hash to the same address. Another issue to consider is that ideally, every address in the table should be equally likely to be the first address in a probe sequence. As an example of a hash function that uses all the information in the key but fails on this second issue is this: h(k) = sum of the digits of k. To see that this fails the second test, suppose the keys are 10-digit telephone numbers, and we have a table with 1000 addresses.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions