 
Summary: Efficient Special Cases of Pattern Matching with Swaps
Amihood Amir \Lambda Gad M. Landau y Moshe Lewenstein z Noa Lewenstein x
Georgia Tech Polytechnic University BarIlan University BarIlan University
and and
BarIlan University Haifa University
Abstract
Let a text string T of n symbols and a pattern string P of m symbols from alphabet \Sigma be given. A
swapped version T 0 of T is a length n string derived from T by a series of local swaps, (i.e. t 0
`
/ t `+1 and
t 0
`+1
/ t ` ) where each element can participate in no more than one swap.
The Pattern Matching with Swaps problem is that of finding all locations i for which there exists a
swapped version T 0 of T where there is an exact matching of P at location i of T 0 .
It was recently shown that the Pattern Matching with Swaps problem has a solution in time
O(nm 1=3 log m log 2 oe), where oe = min(j\Sigmaj; m).
We consider some interesting special cases of patterns, namely, patterns where there is no lengthone
run, i.e. there are no a; b; c 2 \Sigma where b 6= a and b 6= c and where the substring abc appears in the
pattern. We show that for such patterns the pattern matching with swaps problem can be solved in time
