Pattern Recognition in comparison -


i totally new pattern matching or recognition. question that, if have series of strings, say, str1: abcaaaaaaaefg, str2: abcbbbbbbbbcc, str3: sssccccccccefg, etc. want compare strings , find out shared patters in same positions.

for example, want compare str1 str2, result of matching there shared pattern: abc beginning. second step compare str1 str3, result there shred pattern: efg end. want make comparison every 2 pairs in set: (str1,str2), (str1,str3), (str2, str3). etc.

how can programmatically. question may general, totally new area , need know if there tools or functions out there can me efficiently.

edit: 1) normally, strings have same length.

it shouldn't difficult write own program this.

start @ 0 both strings, compare. if != move next index, else mark match , move next char. keep going till don't match , note matching substring. can skip ahead next index in string because know if had matched 0-n, starting @ 1 still break @ n , of smaller length.

oh, , hope don't have many strings, because you're going need n(n+1)/2 comparisons if want match every pair.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -