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?