mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-14 13:28:09 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
1e8f767d3c
commit
0094577a48
|
@ -47,7 +47,9 @@ class SuffixArray:
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
if rank[i] > 0:
|
if rank[i] > 0:
|
||||||
j = suffix_array[rank[i] - 1]
|
j = suffix_array[rank[i] - 1]
|
||||||
while (i + h < n) and (j + h < n) and self.text[i + h] == self.text[j + h]:
|
while (
|
||||||
|
(i + h < n) and (j + h < n) and self.text[i + h] == self.text[j + h]
|
||||||
|
):
|
||||||
h += 1
|
h += 1
|
||||||
lcp[rank[i]] = h
|
lcp[rank[i]] = h
|
||||||
if h > 0:
|
if h > 0:
|
||||||
|
@ -83,7 +85,8 @@ class SuffixArray:
|
||||||
print("\nLCP Array:")
|
print("\nLCP Array:")
|
||||||
for i in range(1, len(self.lcp_array)):
|
for i in range(1, len(self.lcp_array)):
|
||||||
print(
|
print(
|
||||||
f"LCP between {self.text[self.suffix_array[i - 1]:]} and {self.text[self.suffix_array[i]:]}: {self.lcp_array[i]}")
|
f"LCP between {self.text[self.suffix_array[i - 1]:]} and {self.text[self.suffix_array[i]:]}: {self.lcp_array[i]}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Example usage:
|
# Example usage:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user