Skip to content

Commit 18e60cb

Browse files
committed
new line
1 parent 3adae51 commit 18e60cb

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

pydatastructs/trees/fenwich_tree.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ def range_sum(self, start_index, end_index):
8383
"""
8484
if not (0 <= start_index <= end_index < self.size):
8585
raise IndexError("Indices out of bounds")
86-
if start_index == 0:
86+
if start_index is 0:
8787
return self.prefix_sum(end_index)
8888
else:
8989
return self.prefix_sum(end_index) - self.prefix_sum(start_index - 1)
90-
90+
91+

pydatastructs/trees/trie.py

Lines changed: 5 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) == 1 and not node.is_end_of_word:
54+
while len(node.children) is 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 == 0
90+
return self.word_count is 0
9191

9292
def find_all_words(self):
9393
"""Retrieves all words currently stored in the Trie."""
@@ -107,7 +107,7 @@ def shortest_unique_prefix(self, word):
107107
prefix = ""
108108
for char in word:
109109
prefix += char
110-
if len(node.children[char].children) <= 1 and node.children[char].is_end_of_word == False :
110+
if len(node.children[char].children) <= 1 and node.children[char].is_end_of_word is False :
111111
return prefix
112112
node = node.children[char]
113113
return word
@@ -117,4 +117,5 @@ def longest_word(self):
117117
all_words = self.find_all_words()
118118
if not all_words:
119119
return None
120-
return max(all_words, key=len)
120+
return max(all_words, key=len)
121+

pydatastructs/utils/misc_util.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,5 +623,3 @@ def summation(x_y):
623623
return x if y is None else y
624624

625625
return x + y
626-
627-

0 commit comments

Comments
 (0)