Create binary_trie.py - #11918
Create binary_trie.py#11918ankan2526 wants to merge 4 commits into
Conversation
Useful in Competitive Programming. Contains method to find maximum and minimum XOR value.
for more information, see https://pre-commit.ci
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.
| self.to = [[-1], [-1]] | ||
| self.mb = max_bit_len | ||
|
|
||
| def add(self, a): |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file data_structures/trie/binary_trie.py, please provide doctest for the function add
Please provide return type hint for the function: add. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: a
Please provide descriptive name for the parameter: a
| u = self.to[d][u] | ||
| self.cc[u] += 1 | ||
|
|
||
| def remove(self, a): |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file data_structures/trie/binary_trie.py, please provide doctest for the function remove
Please provide return type hint for the function: remove. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: a
Please provide descriptive name for the parameter: a
| self.cc[u] -= 1 | ||
| return True | ||
|
|
||
| def cnt(self, a): |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file data_structures/trie/binary_trie.py, please provide doctest for the function cnt
Please provide return type hint for the function: cnt. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: a
Please provide descriptive name for the parameter: a
| return 0 | ||
| return self.cc[u] | ||
|
|
||
| def min_xor(self, a): |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file data_structures/trie/binary_trie.py, please provide doctest for the function min_xor
Please provide return type hint for the function: min_xor. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: a
Please provide descriptive name for the parameter: a
| u = v | ||
| return res | ||
|
|
||
| def max_xor(self, a): |
There was a problem hiding this comment.
As there is no test file in this pull request nor any test function or class in the file data_structures/trie/binary_trie.py, please provide doctest for the function max_xor
Please provide return type hint for the function: max_xor. If the function does not return a value, please provide the type hint as: def function() -> None:
Please provide type hint for the parameter: a
Please provide descriptive name for the parameter: a
| @@ -0,0 +1,71 @@ | |||
| class BinaryTrie: | |||
| def __init__(self, max_bit_len=31): | |||
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: max_bit_len
|
No descriptive names, no type hints, no doctests. See CONTRIBUTING.md. |
Data Structure for maintaining Binary Trie.
Useful in Competitive Programming.
Contains method to find maximum and minimum XOR value.