Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
assignments
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
datovky
assignments
Commits
efe15b97
Commit
efe15b97
authored
6 years ago
by
Martin Mareš
Browse files
Options
Downloads
Patches
Plain Diff
Cuckoo hashing: Improved readability
parent
dc065fd6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
09-cuckoo_hash/python/cuckoo_hash.py
+1
-2
1 addition, 2 deletions
09-cuckoo_hash/python/cuckoo_hash.py
with
1 addition
and
2 deletions
09-cuckoo_hash/python/cuckoo_hash.py
+
1
−
2
View file @
efe15b97
...
@@ -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.
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment