Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python please for xin cele slots: Continuing on with your SimpleHashTable class implementation, The get_new_hash_code_linear_probing(self, index) method which takes an integer as a parameter and

image text in transcribedpython please

for xin cele slots: Continuing on with your SimpleHashTable class implementation, The get_new_hash_code_linear_probing(self, index) method which takes an integer as a parameter and uses the linear probing technique to determine where the key should be placed in the hash table when a collision occurs. Modify the put(self, key) method. The method should call the get_new_hash_code_linear_probing() method to calculate the next available index position when a collision occurs. Note: You may assume there will be space in the hash table for the key. Submit the entire class definition in the answer box. Keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks. a . For example: Test Result my_hash_table = SimpleHashTable(13) [13, 26, 14, 15, 16, 17, None, None, None, None, None, None, None] my_hash_table.put(13) my_hash_table.put(26) my_hash_table.put(14) my_hash_table.put(15) my_hash_table.put(16) my_hash_table.put(17) print(my_hash_table) Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %) 1 class SimpleHashTable: def __init__(self,size-7): self. size - size self. slots - [None] * size def _str_(self): def get_hash_code(self,key) return str(self. slots) return key (self._size) def put(self, key): 10 code-self.get_hash_code(key) () 11 self-Slots Icode] - key 12 def len(self): 13 15 if x is not None: count + 1 17 return count 2 4 F 7 8 9 Precheck Check check only Test Expected Got my_hash_table = SimpleHashTable(13) [13, 26, 39, 52, None, None, None, None, None, None, None, None, None] ***Error*** my_hash_table.put(13) Traceback (most recent call last): my_hash_table.put(26) File "_tester_.python3", line 66, in

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

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

General Purpose of Your Speech Analyzing Your Audience

Answered: 1 week ago