Advertisement
Morass

lcp

Nov 12th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. void lcp(int*sa,int*lcp,int n,uc*s){
  2. static int r[MX];
  3. F(n)r[sa[i]]=i,lcp[i]=0;;
  4. int h(0);F(n)if(r[i]<n-1){
  5. for(int j(sa[r[i]+1]);s[i+h]==s[j+h];++h);
  6. lcp[r[i]]=h;
  7. if(h)--h;
  8. }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement