原作者:远航之曲;
博主声明:博主太懒了+打字极慢,于是在征得远航之曲大神的同意后直接转载他的博文,只将代码替换为本人的代码,原作者的代码里存在一定数量的让人不知所谓的压行——当然其实市面上大都是这样压着行写的,然而博主业界良心,然后基本每句一注释,最后再次感谢曲大神
又及:变量表与函数表:
int c[10010];//c[sort key]=the number of the strings which have this key(桶); int x[10010];//x[string's NUM]=the rank with the sort key now; int y[10010];//y[the rank of the second key]=string's NUM; char s[10010];//s[the adress in the string]=the char; int sa[10010];//sa[the rank of the string]=num; int rank[10010];//rank[the string's num]=rank; int height[10010];//height[rank]=len of lcp int n,m;//n:the len of the string,m:the diction_num void build_SA(); void build_rank(); void build_height();