Skip to content

Commit eff8726

Browse files
committed
nits
1 parent ce8fad6 commit eff8726

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/strings/suffix_array/suffix_array_short.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
//! vi s_vec;
88
//! auto [sa1, sa_inv1, lcp1] = sa_short(s_vec);
99
//! @endcode
10-
//! runs in ~0.5s for 5e5
10+
//! about 2-3x slower than KACTL
1111
//! @time O(n * log^2(n))
1212
//! @space O(n)
1313
auto sa_short(const auto& s) {
14-
const int n = sz(s), b = 6;
14+
int n = sz(s), b = 6;
1515
vi sa(n), sa_inv(all(s)), lcp(n - 1);
1616
iota(all(sa), 0);
1717
for (int j = 1; j <= n; j *= b) {
@@ -24,7 +24,7 @@ auto sa_short(const auto& s) {
2424
}
2525
return false;
2626
};
27-
sort(all(sa), cmp);
27+
stable_sort(all(sa), cmp);
2828
sa_inv[sa[0]] = 0;
2929
rep(i, 1, n) sa_inv[sa[i]] =
3030
sa_inv[sa[i - 1]] + cmp(sa[i - 1], sa[i]);

0 commit comments

Comments
 (0)