Skip to content

Commit 31771ab

Browse files
committed
HashTables.py changed
1 parent 9ed719d commit 31771ab

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#preventing collisions in hash ord by multiplying the ordinal numbers
2+
3+
def myhash(item):
4+
mult=1
5+
hv=0
6+
7+
for ch in item:
8+
hv += mult*ord(ch)
9+
mult+=1
10+
return hv

0 commit comments

Comments
 (0)