Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm searching for a best way to improve suffix array run time using LCP.

My text (about 2 500 000 chars) seems like: 0ricco0eric0america0polo0....

My thoughs:

SA=suffixArray
char=firstChar(input)
s = suffix array index of a first value char 

currentWord is area (string) in the text from 0 to next 0 where the substring is found, hence: for founded substring icco would be currentWord ricco

repeat
    if pattern in text[SA[s]:SA[s]+len(input)]
        break
    s+=1
results.append(currentWord)

repeat
    if lcp[s]>=len(input)
        results.append(currentWord)
        s+=1
    else:
         break

Is this a correct way? Or could you give me an advice how it should be?

share|improve this question
1  
why didn't you ask at Stack Overflow? meta.stackexchange.com/a/129632/165773 –  gnat May 12 at 14:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.