The problem statement for this problem can be found at this link - https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=660. When I first read the problem I just could not visualize how suffix array concept is applied in this question. I read the code from this link - https://yuting-zhang.github.io/uva/2016/03/22/UVa-719.html. If some one can take one small example and help me with the complete trace applying Suffix array and LCP concepts would be really helpful.
ALso I didn't get the meaning of this line in the code in the link I have mentioned :
What is this assignment doing - LCP[i + 1] == n - 1 - SA[i] ?
for (int i = 0; i < n; i++)
if (SA[i] < (n >> 1)){
if (i + 1 < n && SA[i + 1] < (n >> 1) && **LCP[i + 1] == n - 1 - SA[i]**) --
continue;
printf("%d\n", SA[i] + 1);
break;
}
Aucun commentaire:
Enregistrer un commentaire