Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following U.S. state abbreviations as your keys to a hash table: AZ, AL, HI, NJ, OK, LA, NC, WA, RI, MA, WY, OR,
Consider the following U.S. state abbreviations as your keys to a hash table: AZ, AL, HI, NJ, OK, LA, NC, WA, RI, MA, WY, OR, KS (The entries accessed by these keys need not concern us; perhaps they are large records containing information about the corresponding state.) Use the following hash function: H(s)=s13+s2 where s1 and s2 are the positions of the first and second letters of the key s in the alphabet. (So, when s=AZ,s1=1 and s2=26 ) 1. [5 points] (a) What is the range of the hash function H ? 2. [5 points] (b) If the size of your hash table less than the size of the range, how do you convert the hash function into an index into the hash table? 3. [5 points] (c) Construct a hash table of size 23 using open hashing as your mechanism for handling collisions. Show all the steps, i.e., draw the hash table every time you add a new key. (Note, it might be easiest to write a program in a high level language like Python to do this) 4. [5 points] (d) What is the load factor of this hash table? 5. [5 points] (e) How many words of memory does it occupy (in addition to the space occupied by the entries). Assume that pointers occupy one word, and that your hash table stores pointers to the entries
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started