Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

J Number Hashing Each student at CCP is assigned an ID called a I Number. Every ) Number consists of the letter followed by 8

image text in transcribed
J Number Hashing Each student at CCP is assigned an ID called a "I Number". Every ) Number consists of the letter followed by 8 digits. For example, "112345678". Your assignment is to create a custom hash function for Numbers. You're only interested in the function's performance: how well it avoids collisions without any collision resolution. You do not actually need to create a hash table, only create the hash function and test it in the following four ways: 100 randomly generated Numbers hashed for an array with a length of 127. 500 randomly generated J Numbers hashed for an array with a length of 512. 1000 randomly generated Numbers hashed for an array with a length of 1024. 25000 randomly generated Numbers hashed for an array with a length of 27000. o Roughly the current enrollment at CCP To establish a baseline, complete all four tests with the simple string hash function shown in the lecture slides and sample code. Compare the results of your hash function's performance and the simple string hash function's performance. If necessary, tweak your hash function so that it performs better than the simple hash function. You will need to keep track of how many times a collision occurred in both cases. You could create arrays of the appropriate length and increment each index that is the result of the hash function. If, at the end of the test, index 4 contained a 3, it means there were two collisions for that index. (See the Test.cpp source code files in the Hashing Comparisons folder of the Module download for inspiration.) Your hash function should expect a string containing a Number, not an int or other data type. In a separate document, you will explain: How your hash function works: its complexity, how you came up with the idea for the implementation of your hash function, how you tweaked/improved your original idea, etc. Its performance in the four tests: how well did the hash function do at distributing indexes, how well did it avoid collisions, what was the ratio of successful hashes to collisions, etc. How your hash function performed compared to the simple string hash function. J Number Hashing Each student at CCP is assigned an ID called a "I Number". Every ) Number consists of the letter followed by 8 digits. For example, "112345678". Your assignment is to create a custom hash function for Numbers. You're only interested in the function's performance: how well it avoids collisions without any collision resolution. You do not actually need to create a hash table, only create the hash function and test it in the following four ways: 100 randomly generated Numbers hashed for an array with a length of 127. 500 randomly generated J Numbers hashed for an array with a length of 512. 1000 randomly generated Numbers hashed for an array with a length of 1024. 25000 randomly generated Numbers hashed for an array with a length of 27000. o Roughly the current enrollment at CCP To establish a baseline, complete all four tests with the simple string hash function shown in the lecture slides and sample code. Compare the results of your hash function's performance and the simple string hash function's performance. If necessary, tweak your hash function so that it performs better than the simple hash function. You will need to keep track of how many times a collision occurred in both cases. You could create arrays of the appropriate length and increment each index that is the result of the hash function. If, at the end of the test, index 4 contained a 3, it means there were two collisions for that index. (See the Test.cpp source code files in the Hashing Comparisons folder of the Module download for inspiration.) Your hash function should expect a string containing a Number, not an int or other data type. In a separate document, you will explain: How your hash function works: its complexity, how you came up with the idea for the implementation of your hash function, how you tweaked/improved your original idea, etc. Its performance in the four tests: how well did the hash function do at distributing indexes, how well did it avoid collisions, what was the ratio of successful hashes to collisions, etc. How your hash function performed compared to the simple string hash function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions