Skip to content
Snippets Groups Projects
Commit efe15b97 authored by Martin Mareš's avatar Martin Mareš
Browse files

Cuckoo hashing: Improved readability

parent dc065fd6
Branches
No related tags found
No related merge requests found
...@@ -46,8 +46,7 @@ class CuckooTable: ...@@ -46,8 +46,7 @@ class CuckooTable:
b0 = self.hashes[0].hash(key) b0 = self.hashes[0].hash(key)
b1 = self.hashes[1].hash(key) b1 = self.hashes[1].hash(key)
# print("## Lookup key={} b0={} b1={}".format(key, b0, b1)) # print("## Lookup key={} b0={} b1={}".format(key, b0, b1))
return (self.table[b0] is not None and self.table[b0] == key) or \ return self.table[b0] == key or self.table[b1] == key
(self.table[b1] is not None and self.table[b1] == key)
def insert(self, key): def insert(self, key):
"""Insert a new key to the table. Assumes that the key is not present yet.""" """Insert a new key to the table. Assumes that the key is not present yet."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment