Question: Need help with python In lectures we discussed the implementation of a hash table that used linear probing for collision resolution. In this exercise you

 Need help with python In lectures we discussed the implementation ofa hash table that used linear probing for collision resolution. In thisexercise you will modify this hash table class so that it usesdouble hashing for collision resolution. The hash table will also increase itssize whenever its load factor is 0.75 or more. The hash tablewill contair key-data pairs. You can assume that keys will be integer

Need help with python

In lectures we discussed the implementation of a hash table that used linear probing for collision resolution. In this exercise you will modify this hash table class so that it uses double hashing for collision resolution. The hash table will also increase its size whenever its load factor is 0.75 or more. The hash table will contair key-data pairs. You can assume that keys will be integer values and data strings. Your hash table class will be called HashTable. The constructor for this class has no parameter. Five instance variables will be initialized: size-the size of the hash table count - the number of items in the hash table slots-a python list with size number of elements. data - a python list with size number of elements. deleted- a string consisting of the null character "O" You will need to modify the put ) and delete ) functions discussed in class You will also need to implement a number of your own functions. This should be done in steps as listed below: 1. Modify the put () and delete) functions so that the variable count is altered appropriately whenever a key-data pair is added to or deleted from the hash table. Change the len function so that it returns this count. 2. Your hash table will use the remainder method as discussed in lectures: key% size. For collision resolution you will need to implement a second hash function: size-key % (size-1) + 1). You will need to alter the implementation of the rehash ) function to use this second hash function. 3. You will need to implement a function load) that calculates the load factor of the hash table. Remember that the load factor is calculated using the formula: X- count/size 4. To increase the size of the hash table you want to find a prime number that approximately doubles its In lectures we discussed the implementation of a hash table that used linear probing for collision resolution. In this exercise you will modify this hash table class so that it uses double hashing for collision resolution. The hash table will also increase its size whenever its load factor is 0.75 or more. The hash table will contair key-data pairs. You can assume that keys will be integer values and data strings. Your hash table class will be called HashTable. The constructor for this class has no parameter. Five instance variables will be initialized: size-the size of the hash table count - the number of items in the hash table slots-a python list with size number of elements. data - a python list with size number of elements. deleted- a string consisting of the null character "O" You will need to modify the put ) and delete ) functions discussed in class You will also need to implement a number of your own functions. This should be done in steps as listed below: 1. Modify the put () and delete) functions so that the variable count is altered appropriately whenever a key-data pair is added to or deleted from the hash table. Change the len function so that it returns this count. 2. Your hash table will use the remainder method as discussed in lectures: key% size. For collision resolution you will need to implement a second hash function: size-key % (size-1) + 1). You will need to alter the implementation of the rehash ) function to use this second hash function. 3. You will need to implement a function load) that calculates the load factor of the hash table. Remember that the load factor is calculated using the formula: X- count/size 4. To increase the size of the hash table you want to find a prime number that approximately doubles its

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 Databases Questions!