-
-
Notifications
You must be signed in to change notification settings - Fork 46.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added doctest to double_hash.py #11020
Conversation
@@ -35,6 +35,33 @@ def __hash_double_function(self, key, data, increment): | |||
return (increment * self.__hash_function_2(key, data)) % self.size_table | |||
|
|||
def _collision_resolution(self, key, data=None): | |||
""" | |||
Examples: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool
3. Try to add three data elements when the size is one | ||
>>> dh = DoubleHash(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. Try to add three data elements when the size is one | |
>>> dh = DoubleHash(2) | |
3. Try to add three data elements when the size is one | |
>>> dh = DoubleHash(1) |
Typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
I tested adding elements to DoubleHash with size 1, to my surprise it resulted in getting stuck in infinite loop, where a new hash value tries to be calculated but is unable to.
For now I have changed that part of test. I'll soon be raising an issue and also will try to fix it.
* Added doctest to double_hash.py * Update double_hash.py
Describe your change:
Contributes to #9943
Checklist: