Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

image text in transcribed

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): return

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

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions

Question

5. What information would the team members need?

Answered: 1 week ago

Question

Which team solution is more likely to be pursued and why?

Answered: 1 week ago