Skip to content

Instantly share code, notes, and snippets.

View a-djebali's full-sized avatar

Ahmed Djebali a-djebali

View GitHub Profile
class HashTable:
def __init__(self, table_size, hash_function = None):
self.table_size = table_size
self.hash_table = {i:None for i,x in enumerate(range(self.table_size))} # slots
self.data = [None] * self.table_size
if hash_function is None:
self.hash_function = self.remainder_hash
else:
self.hash_function = self.linear_probing_hash