Information Processing Letters 92 (2004) 293–297 www.elsevier.com/locate/ipl Scaled and permuted string matching Ayelet Butman a , Revital Eres b,1 , Gad M. Landau b,c,∗,2 a Holon Academic Institute of Technology, Israel b Department of Computer Science, Haifa University, Haifa 31905, Israel c Department of Computer and Information Science, Polytechnic University, Six MetroTech Center, Brooklyn, NY 11201-3840, USA Received 24 June 2004; received in revised form 6 September 2004 Available online 12 October 2004 Communicated by L.A. Hemaspaandra Abstract The goal of scaled permuted string matching is to find all occurrences of a pattern in a text, in all possible scales and permutations. Given a text of length n and a pattern of length m we present an O(n) algorithm. 2004 Elsevier B.V. All rights reserved. Keywords: Algorithms; Approximate string matching; Permutations; Scalings 1. Introduction The well-known string matching problem that ap- pears in all algorithm textbooks has as its input a text T of length n and a pattern P of length m over a given alphabet Σ . The output is all text locations where there is an exact match of the pattern. This problem has re- ceived much attention, and many algorithms have been developed to solve it (e.g., [6,13,14]). A detailed mod- * Corresponding author. E-mail addresses: butmosh@zahav.net.il (A. Butman), revitale@cslx.haifa.ac.il (R. Eres), landau@poly.edu (G.M. Landau). 1 Partially supported by the Israel Science Foundation grant 282/01. 2 Partially supported by NSF grant CCR-0104307, by the Israel Science Foundation grant 282/01, and by IBM Faculty Award. ern view of stringology can be found in a number of published books [5,7,11]. Most recent work has dealt with inexact matches. Many types of differences between the patterns were defined, for example, errors (Hamming distance, LCS [12], Edit distance [15]), rotations [1,3,9,10], scaling [2,4], or permutation. Most of the theoretical work has dealt with one type of difference at a time. This paper is one of the first attempts to deal with two types of differences together—scaling and permutation. Definition 1 (Scaled permuted string matching). Input: A pattern P = p 1 ··· p m and a text T = t 1 ··· t n both over alphabet Σ . Output: All positions in T where an occurrence of a permuted copy of the pattern P , scaled to k starts 0020-0190/$ – see front matter 2004 Elsevier B.V. All rights reserved. doi:10.1016/j.ipl.2004.09.002