We present an on-line linear time and space algorithm to check if an integer array f is the border array of at least one string w built on a bounded or unbounded size alphabet Σ . First of all, we show a bijection between the border array of a string w and the skeleton of the DFA recognizing Σ*ω, called a string matching automaton (SMA). Different strings can have the same border array but the originality of the presented method is that the correspondence between a border array and a skeleton of SMA is independent from the underlying strings. This enables to design algorithms for validating and generating border arrays that outperform existing ones. The validating algorithm lowers the delay (maximal number of comparisons on one element of the array) from O(|w|) to 1 + min{|Σ|,1 + log 2 |ω|} compared to existing algorithms. We then give results on the numbers of distinct border arrays depending on the alphabet size. We also present an algorithm that checks if a given directed unlabeled graph G is the skeleton of a SMA on an alphabet of size s in linear time. Along the process the algorithm can build one string w for which G is the SMA skeleton.
[1]
Peter Weiner,et al.
Linear Pattern Matching Algorithms
,
1973,
SWAT.
[2]
Arnaud Lefebvre,et al.
Border Array on Bounded Alphabet
,
2002,
Stringology.
[3]
Maxime Crochemore,et al.
Algorithms on strings
,
2007
.
[4]
C. Hancart.
Analyse exacte et en moyenne d'algorithmes de recherche d'un motif dans un texte
,
1993
.
[5]
Imre Simon.
String Matching Algorithms and Automata
,
1994,
Results and Trends in Theoretical Computer Science.
[6]
Alfred V. Aho,et al.
The Design and Analysis of Computer Algorithms
,
1974
.
[7]
W. F. Smyth,et al.
Verifying a border array in linear time
,
1999
.
[8]
William F. Smyth,et al.
Counting Distinct Strings
,
1999,
Algorithmica.
[9]
Donald E. Knuth,et al.
Fast Pattern Matching in Strings
,
1977,
SIAM J. Comput..
[10]
William F. Smyth,et al.
Computing Patterns in Strings
,
2003
.