We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1e8f767 commit 0094577Copy full SHA for 0094577
divide_and_conquer/Suffix Array and LCP implementation.py
@@ -47,7 +47,9 @@ def build_lcp_array(self) -> List[int]:
47
for i in range(n):
48
if rank[i] > 0:
49
j = suffix_array[rank[i] - 1]
50
- while (i + h < n) and (j + h < n) and self.text[i + h] == self.text[j + h]:
+ while (
51
+ (i + h < n) and (j + h < n) and self.text[i + h] == self.text[j + h]
52
+ ):
53
h += 1
54
lcp[rank[i]] = h
55
if h > 0:
@@ -83,7 +85,8 @@ def display(self) -> None:
83
85
print("\nLCP Array:")
84
86
for i in range(1, len(self.lcp_array)):
87
print(
- f"LCP between {self.text[self.suffix_array[i - 1]:]} and {self.text[self.suffix_array[i]:]}: {self.lcp_array[i]}")
88
+ f"LCP between {self.text[self.suffix_array[i - 1]:]} and {self.text[self.suffix_array[i]:]}: {self.lcp_array[i]}"
89
+ )
90
91
92
# Example usage:
0 commit comments