summaryrefslogtreecommitdiff
path: root/string/suffixArray.cpp
diff options
context:
space:
mode:
authorMZuenni <michi.zuendorf@gmail.com>2023-03-01 11:36:26 +0100
committerMZuenni <michi.zuendorf@gmail.com>2023-03-01 11:36:26 +0100
commit12afe719ce268bb10aa93a910079a44eb08999b8 (patch)
tree0937a117287eebe3942e0506d27143eff4980d09 /string/suffixArray.cpp
parentad8456f7c5d44d3c647b3a368050a5d2f39ae3c3 (diff)
removed trailing whitespaces and use more structured bindings
Diffstat (limited to 'string/suffixArray.cpp')
-rw-r--r--string/suffixArray.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/string/suffixArray.cpp b/string/suffixArray.cpp
index df6259a..720148c 100644
--- a/string/suffixArray.cpp
+++ b/string/suffixArray.cpp
@@ -9,11 +9,11 @@ struct SuffixArray {
for (int i = 0; i < n; i++) P[0][i] = s[i];
for (step = 1, count = 1; count < n; step++, count *= 2) {
for (int i = 0; i < n; i++)
- L[i] = {{P[step-1][i],
+ L[i] = {{P[step-1][i],
i+count < n ? P[step-1][i+count] : -1}, i};
sort(all(L));
for (int i = 0; i < n; i++) {
- P[step][L[i].second] =
+ P[step][L[i].second] =
i > 0 && L[i].first == L[i-1].first ?
P[step][L[i-1].second] : i;
}}