Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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,
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: openHash.py v 1 #Implement an OPEN hash table with 2 #hash function hash(i,N)=i%n class OpenHash: def __init__(self,n): return def str__(self): return def hash(self,i): return def insert(self, num): return def member(self, num): return def delete(self, num): return 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: openHash.py v 1 #Implement an OPEN hash table with 2 #hash function hash(i,N)=i%n class OpenHash: def __init__(self,n): return def str__(self): return def hash(self,i): return def insert(self, num): return def member(self, num): return def delete(self, num): returnStep 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