Skip to content

Commit 2aa1327

Browse files
Update
1 parent b20db73 commit 2aa1327

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Chapter08/hashtable_chaining.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ def search(self, key):
3434
current = self.head
3535
while current:
3636
if current.key == key:
37-
print("list ",current.key, current.value)
37+
print("\"Record found:", current.key, "-", current.value, "\"")
3838
return True
3939
current = current.next
4040
return False
4141

4242

4343

44-
class HashTable:
44+
class HashTableChaining:
4545
def __init__(self):
4646
self.size = 6
4747
self.slots = [None for i in range(self.size)]
@@ -79,7 +79,7 @@ def printHashTable(self) :
7979

8080

8181

82-
ht = HashTable()
82+
ht = HashTableChaining()
8383
ht.put("good", "eggs")
8484
ht.put("better", "ham")
8585
ht.put("best", "spam")
@@ -99,4 +99,4 @@ def printHashTable(self) :
9999
print(v)
100100

101101

102-
ht.printHashTable()
102+
ht.printHashTable()

0 commit comments

Comments
 (0)