summaryrefslogtreecommitdiff
path: root/string
diff options
context:
space:
mode:
Diffstat (limited to 'string')
-rw-r--r--string/ahoCorasick.cpp4
-rw-r--r--string/manacher.cpp2
-rw-r--r--string/rollingHash.cpp2
-rw-r--r--string/suffixArray.cpp4
-rw-r--r--string/suffixTree.cpp4
5 files changed, 8 insertions, 8 deletions
diff --git a/string/ahoCorasick.cpp b/string/ahoCorasick.cpp
index bfde5b6..41bd788 100644
--- a/string/ahoCorasick.cpp
+++ b/string/ahoCorasick.cpp
@@ -5,7 +5,7 @@ struct AhoCorasick {
int suffix, exit, character, parent;
vector<int> nxt, patterns;
vert(int c, int p) : suffix(-1), exit(-1),
- character(c), nxt(ALPHABET_SIZE, -1), parent(p) {}
+ character(c), nxt(ALPHABET_SIZE, -1), parent(p) {}
};
vector<vert> aho;
@@ -29,7 +29,7 @@ struct AhoCorasick {
if (aho[v].suffix == -1) {
if (v == 0 || aho[v].parent == 0) aho[v].suffix = 0;
else aho[v].suffix = go(getSuffix(aho[v].parent),
- aho[v].character);
+ aho[v].character);
}
return aho[v].suffix;
}
diff --git a/string/manacher.cpp b/string/manacher.cpp
index a1cf2da..209896b 100644
--- a/string/manacher.cpp
+++ b/string/manacher.cpp
@@ -15,7 +15,7 @@ void manacher() {
int i2 = 2 * center - i;
longest[i] = (last > i) ? min(last - i, longest[i2]) : 0;
while (i + longest[i] + 1 < n && i - longest[i] - 1 >= 0 &&
- b[i + longest[i] + 1] == b[i - longest[i] - 1]) {
+ b[i + longest[i] + 1] == b[i - longest[i] - 1]) {
longest[i]++;
}
if (i + longest[i] > last) {
diff --git a/string/rollingHash.cpp b/string/rollingHash.cpp
index 2185207..da534a1 100644
--- a/string/rollingHash.cpp
+++ b/string/rollingHash.cpp
@@ -5,7 +5,7 @@ struct Hasher {
vector<ll> power = {1}, pref = {0};
ll m, q; char c;
Hasher(const string& s, ll m, ll q, char c) :
- m(m), q(q), c(c) {
+ m(m), q(q), c(c) {
for (char x : s) {
power.push_back(power.back() * q % m);
pref.push_back((pref.back() * q % m + (x - c)) % m);
diff --git a/string/suffixArray.cpp b/string/suffixArray.cpp
index 2650d72..3494a0b 100644
--- a/string/suffixArray.cpp
+++ b/string/suffixArray.cpp
@@ -6,12 +6,12 @@ struct SuffixArray {
SuffixArray(const string& s) : n(sz(s)) {
SA.resize(n); LCP.resize(n); L.resize(n);
- P.assign(ceil(log2(n)) + 1, vector<int>(n));
+ P.assign(__ln(n)*4-2, vector<int>(n));
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],
- i+count < n ? P[step-1][i+count] : -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] =
diff --git a/string/suffixTree.cpp b/string/suffixTree.cpp
index f96992e..7af3ee6 100644
--- a/string/suffixTree.cpp
+++ b/string/suffixTree.cpp
@@ -64,7 +64,7 @@ struct SuffixTree {
break;
}
int split = newVert(tree[nxt].start,
- tree[nxt].start + curLen);
+ tree[nxt].start + curLen);
tree[curVert].next[s[curEdge]] = split;
int leaf = newVert(pos, sz(s));
tree[split].next[s[pos]] = leaf;
@@ -78,6 +78,6 @@ struct SuffixTree {
curEdge = pos - remainder + 1;
} else {
curVert = tree[curVert].suffix ? tree[curVert].suffix
- : root;
+ : root;
}}}
}; \ No newline at end of file