简体   繁体   中英

Finding All longest common substring

I was trying to find ALL longest common substrings between two strings

Supposing that i had computed Suffix array and LCP array correctly as SA[] and LCP[] Is my logic correct or am i missing something?

Here LCP array is between i and i-1 indexes.

Say we have two strings str=abcabc and str1=bc. I change str= str + '#' + str1.

My suffix array SA[]=[6,3,0,7,4,1,8,5,2]

And LCP array be=[0,0,3,0,2,2,0,1,1]

What can be a better algorithm to find them ?

有一篇很好的文章介绍了如何有效地查找所有常见子字符串,并在C中提供了示例。http://www.drdobbs.com/architecture-and-design/algorithm-alley/184404588

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM