(Solved) : 81 Open Hash Table Implement Open Hash Table Hash Table Take Numbers Input Hash Function H Q44150461 . . .
python


8.1 Open Hash Table Implement an Open Hash Table. Your Hash table will only take numbers as input. Your hash function will be hash(val, size) = val % size You must implement the following functions • Constructor: takes number of rows in column • String Method: prints one line for each row in the format shown below • hash: Implements the hash function • insert: Inserts number into hash table • member: returns True if number is in hash table and false otherwise • delete: removes the number from hash table if it exists You are provided with a test script which will use your Open Hash Table. An example execution is provided below. Welcome to Open Hash Table Tests How big would you like your hash table to be? Enter a seed for the random number generator: 12 Created an Empty Hash Table Row 0 [] Row 1 [] Insert Random Numbers in range 0 to 5n Inserting 7 into hash table After Insert your hash table looks like: Row OU Row 1 [7] Inserting 4 into hash table After Insert your hash table looks like: Row 0 [4] Row 1 [7] Testing Member on all numbers from 0 to 5n Passed 10 out of 10 Deleting all values in Hash Deleting value 7 After Delete your hash table looks like: Row 0 [4] Row 1 11 Deleting value 4 After Delete your hash table looks like: Row 0 Row 1 1 Current file: closedHash.py – #Implement an Closed hash table with #hash function hash(i,N)=i mod n 3 #Rehash Strategy: rehash(i,k,N)= (hash(i,N)+k) mod N tin000 class ClosedHash: def __init__(self,n): return def _str_(self): return def hash(self,i): return def rehash(self,i,k): return def insert(self, num): return def member(self, num): return def delete(self, num): return 15 16 17 18 Show transcribed image text 8.1 Open Hash Table Implement an Open Hash Table. Your Hash table will only take numbers as input. Your hash function will be hash(val, size) = val % size You must implement the following functions • Constructor: takes number of rows in column • String Method: prints one line for each row in the format shown below • hash: Implements the hash function • insert: Inserts number into hash table • member: returns True if number is in hash table and false otherwise • delete: removes the number from hash table if it exists You are provided with a test script which will use your Open Hash Table. An example execution is provided below.
Welcome to Open Hash Table Tests How big would you like your hash table to be? Enter a seed for the random number generator: 12 Created an Empty Hash Table Row 0 [] Row 1 [] Insert Random Numbers in range 0 to 5n Inserting 7 into hash table After Insert your hash table looks like: Row OU Row 1 [7] Inserting 4 into hash table After Insert your hash table looks like: Row 0 [4] Row 1 [7] Testing Member on all numbers from 0 to 5n Passed 10 out of 10 Deleting all values in Hash Deleting value 7 After Delete your hash table looks like: Row 0 [4] Row 1 11 Deleting value 4 After Delete your hash table looks like: Row 0 Row 1 1
Current file: closedHash.py – #Implement an Closed hash table with #hash function hash(i,N)=i mod n 3 #Rehash Strategy: rehash(i,k,N)= (hash(i,N)+k) mod N tin000 class ClosedHash: def __init__(self,n): return def _str_(self): return def hash(self,i): return def rehash(self,i,k): return def insert(self, num): return def member(self, num): return def delete(self, num): return 15 16 17 18
Expert Answer
Answer to 8.1 Open Hash Table Implement an Open Hash Table. Your Hash table will only take numbers as input. Your hash function wi…
OR