21.2 Common hash functions

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Will the hash function and expected key likely work well for the following scenarios? Hash function: key % 40 Key: 4-digit even numbers Hash table size: 40

No

For a decimal mid-square hash function, what is the bucket index for key = 110, N = 200, and R = 3?

10

For R = 3, what are the middle bits for a key of 9? 9 * 9 = 81; 81 in binary is 1010001.

100

For a 1000-entry hash table, compute the multiplicative hash for the following strings using the specific initial value and hash multiplier. Initial value = 0 Hash multiplier = 1 String = BAT

215

For a 1000-entry hash table, compute the multiplicative hash for the following strings using the specific initial value and hash multiplier. Initial value = 0 Hash multiplier = 1 String = TAB

215

For a decimal mid-square hash function, what is the bucket index for key = 112, N = 1000, and R = 3?

254

For a 1000-entry hash table, compute the multiplicative hash for the following strings using the specific initial value and hash multiplier. Initial value = 17 Hash multiplier = 3 String = WE

483

For a decimal mid-square hash function, what are the middle digits for key = 40, N = 100, and R = 2?

60

For a binary mid-square hash function, how many bits are needed for an 80 entry hash table?

7

Will the hash function and expected key likely work well for the following scenarios? Hash function: key % 1000 Key: 6-digit employee ID Hash table size: 20000

No

Will the hash function and expected key likely work well for the following scenarios? Hash function: key % 1000 Key: Customer's 3-digit U.S. phone number area code, of which about 300 exist. Hash table size: 1000

No

Will the hash function and expected key likely work well for the following scenarios? Hash function: key % 1000 Key: Selling price of a house. Hash table size: 1000

No

Will the hash function and expected key likely work well for the following scenarios? Hash function: key % 250 Key: 5-digit customer ID Hash table size: 250

Yes


Kaugnay na mga set ng pag-aaral

S86 T-cell receptor and T-cell activation

View Set

Accounting Exam 1 Complete Review

View Set

macroeconomics (ecn 211) final vocabulary

View Set

BIOLOGY DC TEST #1 (SEMESTER TWO)

View Set

Chapter 12: Inventory Management

View Set

ABC 3.1 - (Article 250 - Wiring and Protection)

View Set