Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 . Using the Linear Probing code in tpython as a base, write insert, search and delete functions for: a . A hashtable that implements
Using the Linear Probing code in tpython as a base, write insert, search and delete functions for:
a A hashtable that implements Quadrating Probing
b Implements Double hashing, where the secondary hash function is an argument to Hashtable
constructor
class linearprobing:
def initself n:
self.table None n
self.n n
def insertself key, value:
i hashkey self.n
misses
newi i misses self.n
while self.tablenewi is not None:
k v self.tablenewi
if k key:
break
misses
newi i misses self.n
self.tablenewikey value
def searchself key:
i hashkey self.n
misses
newi i misses self.n
while self.tablenewi is not None:
k v self.tablenewi
if k key:
return v
misses
newi i misses self.n
return None
def deleteself key:
i hashkey self.n
misses
newi i misses self.n
while self.tablenewi is not None:
k v self.tablenewi
if key k:
self.tablenewi None
prev newi
curr misses
newi i curr self.n
while self.tablenewi is not None:
self.tableprev self.tablenewi
prev newi
curr
newi i curr self.n
retur
misses
newi i misses self.n
Step 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