Skip to content

Commit 08d4854

Browse files
committed
Three Hundred - Twenty-One Commit: Implement display() function
1 parent 6585fbd commit 08d4854

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Section_11(Hash-Table)/(2)_hash-table-linear-probing.py

+16
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,19 @@ def search(self, key):
4646
return False
4747
j = j + 1
4848
return True
49+
50+
# Print contents of the table
51+
def display(self):
52+
print(self.hashtable)
53+
54+
55+
H = HashTableLinearProbe()
56+
H.insert(54)
57+
H.insert(78)
58+
H.insert(64)
59+
H.insert(92)
60+
H.insert(34)
61+
H.insert(86)
62+
H.insert(28)
63+
H.display()
64+
print('Search Result: ', H.search(34))

0 commit comments

Comments
 (0)