diff options
author | Ta180m | 2020-06-25 13:56:47 -0500 |
---|---|---|
committer | Ta180m | 2020-06-25 13:56:47 -0500 |
commit | d9d672e7aeeffb6bc582047c154b23f1e7176e6d (patch) | |
tree | c4da6610000fe3a9d8f6289514feedc7c79da686 /String | |
parent | 53d3373f17102ab2176f91b6d44ac2ced23b701d (diff) |
Update suffix_array.cpp
Diffstat (limited to 'String')
-rw-r--r-- | String/suffix_array.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/String/suffix_array.cpp b/String/suffix_array.cpp index 7a989d2..00cb256 100644 --- a/String/suffix_array.cpp +++ b/String/suffix_array.cpp @@ -1,11 +1,11 @@ -vector<int> suffix_array(string& S) { +vector<int> suffix_array(string & S) { int N = S.length(); vector<int> SA(N), rank(N); for (int i = 0; i < N; i++) { SA[i] = N - i - 1; rank[i] = S[i]; } - stable_sort(SA.begin(), SA.end(), [&S](int i, int j) { return S[i] < S[j]; }); + stable_sort(SA.begin(), SA.end(), [& S](int i, int j) { return S[i] < S[j]; }); for (int t = 1; t < N; t <<= 1) { vector<int> tmp(rank); for (int i = 0; i < N; i++) { @@ -22,7 +22,7 @@ vector<int> suffix_array(string& S) { return SA; } -vector<int> lcp_array(const vector<int>& SA, string& S) { +vector<int> lcp_array(const vector<int> & SA, string & S) { int N = S.size(); vector<int> rank(N), LCP(N - 1); for (int i = 0; i < N; i++) rank[SA[i]] = i; |