Question: Remember that the principles of a good hash function are: Determinism ( the same input must map to the same index ) Spread ( related

Remember that the principles of a good hash function are:
Determinism (the same input must map to the same index)
Spread (related but different inputs should map to unrelated indexes, all indexes must be used)
Speed (must run in O(1) time)
For this lab, you will be implementing a hash table that stores strings, so you will need to decide on a hash function to convert strings into indexes. Create a method int hash(string s) that does this conversion and justify your function according to the three principles.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!