Question: Use python to built hashtable data structure: class OrderedHashtable: def __init__(self, index, next=None): This class is used to create nodes in the singly linked chains
Use python to built hashtable data structure:
class OrderedHashtable:
def __init__(self, index, next=None):
"""This class is used to create nodes in the singly linked "chains" in each hashtable bucket.""" self.index = index self.next = next
def __init__(self, n_buckets=1000):
# the following two variables should be used to implement the "two-tiered" # ordered hashtable described in class -- don't rename them! self.indices = [None] * n_buckets self.entries = [] self.count = 0
def __getitem__(self, key):
??????
def __setitem__(self, key, val):
????
def __delitem__(self, key)
???
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
