Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
692 views
in Technique[技术] by (71.8m points)

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

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?

question from:https://stackoverflow.com/questions/66062104/question-of-skew-suffix-array-algorithm-presented-in-simple-linear-work-suffix-a

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...