We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d36d39 commit fcdbb41Copy full SHA for fcdbb41
Suffix-Array(Doubling).cpp
@@ -14,11 +14,6 @@ int l;
14
char s[STRING_LENGTH];
15
int rank[STRING_LENGTH * 2], sa[STRING_LENGTH];
16
17
-inline bool operator == (const sortinfo &x, const sortinfo &y)
18
-{
19
- return x.x == y.x && x.y == y.y;
20
-}
21
-
22
void radix_sort(sortinfo *d)
23
{
24
static sortinfo _d[STRING_LENGTH], res[STRING_LENGTH];
@@ -88,7 +83,11 @@ void init_rank()
88
83
rank[d[0].ord] = 1;
89
84
for (int i = 1; i < l; i++)
90
85
91
- rank[d[i].ord] = (d[i] == d[i - 1] ? x : ++x);
86
+ rank[d[i].ord] = (d[i].x == d[i - 1].x && d[i].y == d[i - 1].y ? x : ++x);
87
+ }
+ if (x == l)
+ {
+ break;
92
}
93
94
0 commit comments