Skip to content

Commit 1e02eda

Browse files
committed
docs: clarify the suffix array docstring
1 parent cacfbac commit 1e02eda

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎strings/suffix_array.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
1010
Construction here uses prefix doubling (Manber-Myers).
1111
12-
Time Complexity: O(n * log(n)^2) - where n is the length of the text
12+
Time Complexity: O(n log² n) - where n is the length of the text
1313
Space Complexity: O(n)
1414
"""
1515

1616

1717
def suffix_array(text: str) -> list[int]:
1818
"""
19-
Return the starting indices of all suffixes of `text`, sorted.
19+
Return the starting indices of all suffixes of `text`, in lexicographic
20+
order.
2021
2122
>>> suffix_array("banana")
2223
[5, 3, 1, 0, 4, 2]

0 commit comments

Comments
 (0)