Sequences II pp 218-224 | Cite as

An Efficient Algorithm for the All Pairs Suffix-Prefix Problem

  • Dan Gusfield
  • Gad M. Landau
  • Baruch Schieber
Conference paper


For a pair of strings (S 1, S 2), define the suffix-prefix match of (S 1, S 2) to be the longest suffix of string S 1 that matches a prefix of string S 2. The following problem is considered in this paper. Given a collection of strings S 1 , S 2,..., S k of total length m, find the suffix-prefix match for each of the k(k - 1) ordered pairs of strings. We present an algorithm that solves the problem in O(m + k 2) time, for any fixed alphabet. Since the size of the input is O(m) and the size of the output is O(k 2 ) this solution is optimal.


Internal Vertex Depth First Search Linear Time Algorithm Suffix Tree Special Symbol 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [AILSV88]
    A. Apostolico, C. Iliopoulos, G.M. Landau, B. Schieber, and U. Vishkin. Parallel construction of a suffix tree with applications. Algorithmica, 3: 347–365, 1988.MathSciNetMATHCrossRefGoogle Scholar
  2. [BJLTY91]
    A. Blum, T. Jiang, M. Li, J. Tromp, and M. Yanakakis. Linear approximation of shortest superstrings. In Proc. of the 23rd ACM Symp. on Theory of Computing, 328–336, 1991.Google Scholar
  3. [KM89]
    J. Kececioglu and E. Myers. A procedural interface for a fragment assembly tool. Technical Report TR 89–5, University of Arizona, Computer Science Dept., April 1989.Google Scholar
  4. [KM91]
    J. Kececioglu and E. Myers. A robust and automatic fragment assembly system, 1991. Manuscript.Google Scholar
  5. [KMP77]
    D.E. Knuth, J.H. Morris, and V.R. Pratt. Fast pattern matching in strings. SIAM Journal on Computing, 6: 323–350, 1977.MathSciNetMATHCrossRefGoogle Scholar
  6. [Les88]
    A. Lesk, editor. Computational Molecular Biology, Sources and Methods for Sequence Analysis. Oxford University Press, Oxford, UK, 1988.Google Scholar
  7. [McC76]
    E.M. McCreight. A space-economical suffix tree construction algorithm. Journal of the ACM, 23: 262–272, 1976.MathSciNetMATHCrossRefGoogle Scholar
  8. [Tar83]
    R.E. Tarjan. Data Structures and Network Algorithms. CBMS-NSF Regional Conference Series in Applied Math. SIAM, Philadelphia, PA, 1983.Google Scholar
  9. [TU88]
    J. Tarhio and E. Ukkonen. A greedy approximation algorithm for constructing shortest common superstrings. Theoretical Computer Science, 57: 131–145, 1988.MathSciNetMATHCrossRefGoogle Scholar
  10. [Tur89]
    J. Turner. Approximation algorithms for the shortest common superstring problem. Information and Computation, 83 (1): 1–20, 1989.MathSciNetMATHCrossRefGoogle Scholar
  11. [Ukk90]
    E. Ukkonen. A linear time algorithm for finding approximate shortest common superstrings. Algorithmica, 5: 313–323, 1990.MathSciNetMATHCrossRefGoogle Scholar
  12. [Wei73]
    P. Weiner. Linear pattern matching algorithm. In Proc. 14th IEEE Symp. on Switching and Automata Theory, pages 1–11, 1973.CrossRefGoogle Scholar

Copyright information

© Springer-Verlag New York, Inc. 1993

Authors and Affiliations

  • Dan Gusfield
    • 1
  • Gad M. Landau
    • 2
  • Baruch Schieber
    • 3
  1. 1.Computer Science DivisionUniversity of California at DavisDavisUSA
  2. 2.Dept. of Computer SciencePolytechnic UniversityBrooklynUSA
  3. 3.IBM - Research DivisionT.J. Watson Research CenterYorktownUSA

Personalised recommendations