tags:

views:

72

answers:

3

Let's say you have a list of similar sequences, such as

a a a a
a b a a a
x a a a a y
...

You want to detect a common aggregate of all these sequences, such as

x? a b? a a a y?

where operator ? specifies that element is optional.

What algorithm would you use?

+3  A: 

Look at the sequence alignment algorithms used in bioinformatics.

More specifically, since you have a list, multiple sequence alignment. The Viterbi algorithm should do.

Tobu
Thanks, I think this will work, I will look into it.
Andrey Shchekin
+1  A: 

I think that if you convert your list to suffix tree then it will be very simple recursive solution but I am not sure about asymptotic complexity

Gaim
+1  A: 

You might want to check out smith-Waterman algorithm that is used for performing sequence alignments.

Alos
That one only does pairwise alignment.
Tobu