class HashTable:
def initself m:
# default initial array length: threshold:
self.inArray LinkedList for i in rangem
self.size
self.threshold
def addself d:
i self.hashd
self.inArrayiinsertd
self.size
if self.size self.thresholdlenselfinArray:
self.resizeUp
def resizeUpself:
oldArray self.inArray
self.inArray LinkedList for i in rangelenoldArray
for i in rangelenoldArray:
while oldArrayilength :
d oldArrayiremove
self.inArrayselfhashdinsertd
Write a function:
def resizeUpself
that, similarly to the corresponding function for HashTable that we saw in class, doubles the length of the internal linked list and rehashes and reinserts all of the elements.