Skip to content

Commit ee36943

Browse files
committed
HashTable: Made rehash private
1 parent f1f5f89 commit ee36943

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

map/hashtable.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def put(self, key, value):
3434
self._values[hash_] = value
3535
return
3636

37-
hash_ = self.rehash(hash_)
37+
hash_ = self._rehash(hash_)
3838

3939
if initial_hash == hash_:
4040
# table is full
@@ -50,7 +50,7 @@ def get(self, key):
5050
# key found
5151
return self._values[hash_]
5252

53-
hash_ = self.rehash(hash_)
53+
hash_ = self._rehash(hash_)
5454
if initial_hash == hash_:
5555
# table is full and wrapped around
5656
return None
@@ -67,15 +67,15 @@ def del_(self, key):
6767
self._values[hash_] = self._deleted
6868
return
6969

70-
hash_ = self.rehash(hash_)
70+
hash_ = self._rehash(hash_)
7171
if initial_hash == hash_:
7272
# table is full and wrapped around
7373
return None
7474

7575
def hash(self, key):
7676
return key % self.size
7777

78-
def rehash(self, old_hash):
78+
def _rehash(self, old_hash):
7979
"""
8080
linear probing
8181
"""

0 commit comments

Comments
 (0)