question of skew suffix array algorithm presented in Simple Linear Work Suffix Array Construction

150 Views Asked by At

At the last of paper 'Simple Linear Work Suffix Array Construction' source code is attached, I cannot understand this part,

// generate positions of mod 1 and mod 2 suffixes
// the "+(n0-n1)" adds a dummy mod 1 suffix if n%3 == 1
for (int i=0, j=0; i < n+(n0-n1); i++) if (i%3 != 0) s12[j++] = i;
// lsb radix sort the mod 1 and mod 2 triples
radixPass(s12 , SA12, s+2, n02, K);
radixPass(SA12, s12 , s+1, n02, K);
radixPass(s12 , SA12, s , n02, K);

The first for loop is used to get mod 1 and mod 2's index in the array; but why the first radixPass the input index should be s+2? How +2 offset is derived?

1

There are 1 best solutions below

0
yewei On BEST ANSWER

After writing in the paper, I know the answer, these three lines are used to radix sort from lsb to msb for mod 1 and mod 2's indices.