Parameterized pattern matching: Algorithms and applications

被引:95
|
作者
Baker, BS
机构
[1] AT and T Bell Laboratories, Murray Hill, NJ 07974
关键词
D O I
10.1006/jcss.1996.0003
中图分类号
TP3 [计算技术、计算机技术];
学科分类号
0812 ;
摘要
The problem of finding sections of code that either are identical or are related by the systematic renaming of variables or constants can be modeled in terms of parameterized strings (p-strings) and parameterized matches (p-matches). P-strings are strings over two alphabets, one of which represents parameters. Two p-strings are a parameterized match (p-match) if one p-string is obtained by renaming the parameters of the other by a one-to-one function. In this paper, we investigate parameterized pattern matching via parameterized suffix trees (p-suffix trees). We give two algorithms for constructing p-suffix trees: one (eager) that runs in linear time for fixed alphabets, and another that uses auxiliary data structures and runs in O(n log(n)) time for Variable alphabets, where n is input length. We show that using a p-suffix tree for a pattern p-string P, it is possible to search for all p-matches of P within a text p-string Tin space linear in \P\ and time linear in \T\ for fixed alphabets, or O(\T\ log(min( \P\, sigma)) time and O(\P\) space for variable alphabets, where sigma is the sum of the alphabet sizes. The simpler p-suffix tree construction algorithm eager has been implemented, and experiments show it to be practical. Since it runs faster than predicted by the above worst-case bound, we reanalyze the algorithm and show that eager runs in time O(min(t\S\ + m(t, S) \ t>0) log sigma)), where for an input p-string S, m(t, S) is the number of maximal p-matches of length at least t that occur within S, and sigma is the sum of the alphabet sizes. Experiments with the author's program dup (B. Baker, in ''Comput. Sci. Statist.,'' Vol. 24, 1992) for finding all maximal p-matches within a p-string have found mt t, S) to be less than \S\ in practice unless t is small. (C) 1996 Academic Press, Inc.
引用
收藏
页码:28 / 42
页数:15
相关论文
共 50 条
  • [1] Sublinear algorithms for parameterized matching
    Salmela, Leena
    Tarhio, Jorma
    COMBINATORIAL PATTERN MATCHING, PROCEEDINGS, 2006, 4009 : 354 - 364
  • [2] Secure parameterized pattern matching
    Zarezadeh, Maryam
    Mala, Hamid
    Ladani, Behrouz Tork
    INFORMATION SCIENCES, 2020, 522 : 299 - 316
  • [3] Compressed Parameterized Pattern Matching
    Beal, Richard
    Adjeroh, Donald A.
    2013 DATA COMPRESSION CONFERENCE (DCC), 2013, : 461 - 470
  • [4] Compressed parameterized pattern matching
    Beal, Richard
    Adjeroh, Donald
    THEORETICAL COMPUTER SCIENCE, 2016, 609 : 129 - 142
  • [5] Parameterized Algorithms and Kernels for Rainbow Matching
    Gupta, Sushmita
    Roy, Sanjukta
    Saurabh, Saket
    Zehavi, Meirav
    ALGORITHMICA, 2019, 81 (04) : 1684 - 1698
  • [6] Parameterized Algorithms and Kernels for Rainbow Matching
    Sushmita Gupta
    Sanjukta Roy
    Saket Saurabh
    Meirav Zehavi
    Algorithmica, 2019, 81 : 1684 - 1698
  • [7] A review on parameterized string matching algorithms
    Singh, Rama
    Rai, Deepak
    Prasad, Rajesh
    JOURNAL OF INFORMATION & OPTIMIZATION SCIENCES, 2018, 39 (01):
  • [8] Parameterized algorithms and kernels for almost induced matching
    Xiao, Mingyu
    Kou, Shaowei
    THEORETICAL COMPUTER SCIENCE, 2020, 846 : 103 - 113
  • [9] Parameterized algorithms for weighted matching and packing problems
    Liu, Yunlong
    Chen, Jianer
    Wang, Jianxin
    THEORY AND APPLICATIONS OF MODELS OF COMPUTATION, PROCEEDINGS, 2007, 4484 : 692 - +
  • [10] Parameterized algorithms for weighted matching and packing problems
    Wang, Jianxin
    Liu, Yunlong
    DISCRETE OPTIMIZATION, 2008, 5 (04) : 748 - 754