An efficient algorithm for the All Pairs Suffix-Prefix Problem
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 ma...
Gespeichert in:
Veröffentlicht in: | Information processing letters 1992-03, Vol.41 (4), p.181-185 |
---|---|
Hauptverfasser: | , , |
Format: | Artikel |
Sprache: | eng |
Schlagworte: | |
Online-Zugang: | Volltext |
Tags: |
Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
|
Zusammenfassung: | 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
Ω(m) and the size of the output is
Ω(k
2)
this solution is optimal. |
---|---|
ISSN: | 0020-0190 1872-6119 |
DOI: | 10.1016/0020-0190(92)90176-V |