feat(hashing): add 6 advanced open addressing algorithms#14048
feat(hashing): add 6 advanced open addressing algorithms#14048ygstudio-game wants to merge 4 commits intoTheAlgorithms:masterfrom
Conversation
- LinearProbing: Standard collision resolution - RobinHoodHashMap: PSL optimization - HopscotchHashMap: Neighborhood caching - CoalescedHashMap: Hybrid chaining - FNVHashMap: FNV-1a hash function - PowerOfTwoHashMap: Bitmask sizing - Add comprehensive unit tests in test_advanced_hashing.py
There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
|
|
||
| @dataclass(slots=True) | ||
| class _Node[KEY, VAL]: | ||
| key: KEY |
There was a problem hiding this comment.
An error occurred while parsing the file: data_structures/hashing/coalesced_hashing.py
Traceback (most recent call last):
File "/opt/render/project/src/algorithms_keeper/parser/python_parser.py", line 146, in parse
reports = lint_file(
^^^^^^^^^^
libcst._exceptions.ParserSyntaxError: Syntax Error @ 20:13.
parser error: error at 19:12: expected one of (, :
key: KEY
^|
|
||
| @dataclass(slots=True) | ||
| class _Item[KEY, VAL]: | ||
| key: KEY |
There was a problem hiding this comment.
An error occurred while parsing the file: data_structures/hashing/fnv_hashtable.py
Traceback (most recent call last):
File "/opt/render/project/src/algorithms_keeper/parser/python_parser.py", line 146, in parse
reports = lint_file(
^^^^^^^^^^
libcst._exceptions.ParserSyntaxError: Syntax Error @ 51:13.
parser error: error at 50:12: expected one of (, :
key: KEY
^|
|
||
| @dataclass(slots=True) | ||
| class _Item[KEY, VAL]: | ||
| key: KEY |
There was a problem hiding this comment.
An error occurred while parsing the file: data_structures/hashing/hopscotch.py
Traceback (most recent call last):
File "/opt/render/project/src/algorithms_keeper/parser/python_parser.py", line 146, in parse
reports = lint_file(
^^^^^^^^^^
libcst._exceptions.ParserSyntaxError: Syntax Error @ 22:13.
parser error: error at 21:12: expected one of (, :
key: KEY
^| Hash function: h(k, i) = (h(k) + i) % m | ||
| """ | ||
|
|
||
| def __init__(self, *args, **kwargs): |
There was a problem hiding this comment.
Please provide return type hint for the function: __init__. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: args
Please provide type hint for the parameter: kwargs
|
|
||
| @dataclass(slots=True) | ||
| class _Item[KEY, VAL]: | ||
| key: KEY |
There was a problem hiding this comment.
An error occurred while parsing the file: data_structures/hashing/power_of_two.py
Traceback (most recent call last):
File "/opt/render/project/src/algorithms_keeper/parser/python_parser.py", line 146, in parse
reports = lint_file(
^^^^^^^^^^
libcst._exceptions.ParserSyntaxError: Syntax Error @ 42:13.
parser error: error at 41:12: expected one of (, :
key: KEY
^|
|
||
| @dataclass(slots=True) | ||
| class _Entry[KEY, VAL]: | ||
| key: KEY |
There was a problem hiding this comment.
An error occurred while parsing the file: data_structures/hashing/robin_hood.py
Traceback (most recent call last):
File "/opt/render/project/src/algorithms_keeper/parser/python_parser.py", line 146, in parse
reports = lint_file(
^^^^^^^^^^
libcst._exceptions.ParserSyntaxError: Syntax Error @ 20:13.
parser error: error at 19:13: expected one of (, :
key: KEY
^There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
| VAL = TypeVar("VAL") | ||
|
|
||
|
|
||
| def _next_power_of_two(n: int) -> int: |
There was a problem hiding this comment.
Please provide descriptive name for the parameter: n
| return 1 << (n - 1).bit_length() | ||
|
|
||
|
|
||
| def _mix_hash(h: int) -> int: |
There was a problem hiding this comment.
Please provide descriptive name for the parameter: h
Describe your change:
Checklist: