-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhashtable.py
More file actions
43 lines (35 loc) · 992 Bytes
/
hashtable.py
File metadata and controls
43 lines (35 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class HashTable:
def __init__(self, size):
pass
def __repr__(self):
"""returns a formatted string containing the values in the hash table"""
return f"HashTable {self.values}"
def _hash(self, key):
"""
Return the hashed value using the rolling polynomial algorithm.
Further reading: https://cp-algorithms.com/string/string-hashing.html
Note:
- The largest value to be returned will be less than size.
Remember to compress the return value to fit the table size (tip: You can use the mod operator once more)
Parameters
---------
- key: str
The key to be hashed
"""
pass
def add(self, key, value):
"""
"""
pass
def get(self, key):
"""
"""
pass
def update(self, key, value):
"""
"""
pass
def remove(self, key):
"""
"""
pass