Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
823 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...