Skip to content

Commit 9a9cca1

Browse files
committed
mitigation
1 parent 418496c commit 9a9cca1

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

pydatastructs/trees/fenwich_tree.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,3 @@ def range_sum(self, start_index, end_index):
8787
return self.prefix_sum(end_index)
8888
else:
8989
return self.prefix_sum(end_index) - self.prefix_sum(start_index - 1)
90-

pydatastructs/trees/trie.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def longest_common_prefix(self):
5151
"""Finds the longest common prefix among all words in the Trie."""
5252
node = self.root
5353
prefix = ""
54-
while len(node.children) is 1 and not node.is_end_of_word:
54+
while len(node.children) == 1 and not node.is_end_of_word:
5555
char = next(iter(node.children))
5656
prefix += char
5757
node = node.children[char]
@@ -87,7 +87,7 @@ def clear(self):
8787

8888
def is_empty(self):
8989
"""Returns True if the Trie is empty, otherwise False."""
90-
return self.word_count is 0
90+
return self.word_count == 0
9191

9292
def find_all_words(self):
9393
"""Retrieves all words currently stored in the Trie."""
@@ -118,5 +118,3 @@ def longest_word(self):
118118
if not all_words:
119119
return None
120120
return max(all_words, key=len)
121-
122-

0 commit comments

Comments
 (0)