Abstract
Consider the prefix matching problem: Given a pattern P of length m and a text T of length n, find for all positions i in T the longest prefix of P starting at i. We present a parallel algorithm for the prefix matching problem over general alphabets whose text search takes optimal O(α(m)) time and preprocessing takes optimal O(log log m) time, where α(m) is the inverse Ackermann function. An Ω(log log m) lower bound for the prefix matching problem is implied by the same lower bound for string matching. However, the lower bound is applied only to preprocessing of the pattern and the searching phase can be faster. We prove an Ω(α(m)) lower bound for any linear-work searching phase. Therefore our algorithm is work-time optimal in both preprocessing and text search. The idea of leftmost witnesses is introduced to obtain the algorithm.
Supported by the EC Cooperative Action IC 1000 Algorithms for Future Technologies “ALTEC”.
Supported by S.N.U. Posco Research Fund 94-15-1112.
Preview
Unable to display preview. Download preview PDF.
References
O. Berkman, B. Schieber, and U. Vishkin, Optimal doubly logarithmic parallel algorithms based on finding all nearest smaller values, J. Algorithms 14 (1993).
O. Berkman and U. Vishkin, Recursive star-tree parallel data structure, SIAM J. Comput. 22 (1993), 221–242.
R.P. Brent, The parallel evaluation of general arithmetic expressions. J. Assoc. Comput. Mach. 21 (1974), 201–206.
D. Breslauer, Fast parallel string prefix-matching, Technical Reports, CWI, 1991.
D. Breslauer, L. Colussi and L. Toniolo, Tight comparison bounds for the string prefix-matching problem, Proc. 4th Symp. Combinatorial Pattern Matching (1993), 11–19.
D. Breslauer and Z. Galil, An optimal O(log log n) time parallel string matching algorithm, SIAM J. Comput. 19 (1990), 1051–1058.
D. Breslauer and Z. Galil, A lower bound for parallel string matching, SIAM J. Comput. 21 (1992), 856–862.
R. Cole, M. Crochemore, Z. Galil, L. Gasieniec, R. Hariharan, S. Muthukrishnan, K. Park and W. Rytter, Optimally fast parallel algorithms for preprocessing and pattern matching in one and two dimensions, Proc. 34th IEEE Symp. Found. Computer Science, 1993.
S. Chauduri and J. Radhakrishnan, The complexity of parallel prefix problems on small domains, Proc. 33rd IEEE Symp. Found. Computer Science 1992, 638–647.
F.E. Fich, P. Ragde and A. Wigderson, Relations between concurrent-write models of parallel computation, SIAM J. Comput. 17 (1988), 606–627.
Z. Galil, Optimal parallel algorithms for string matching, Inform. and Control 67 (1985), 144–157.
Z. Galil, A constant-time optimal parallel string-matching algorithm, Proc. 24th ACM Symp. Theory of Computing, 1992.
R. Hariharan and S. Muthukrishnan, Optimal parallel algorithms for prefix matching, Proc. 21st Int. Colloq. Automata Languages and Programming, 1994.
D.E. Knuth, J.H. Morris, and V.B. Pratt, Fast pattern matching in strings, SIAM J. Comput. 6 (1977), 323–350.
M.G. Main and R.J. Lorentz, An O(n log n) algorithm for finding all repetitions in a string, J. Algorithms 5 (1984), 422–432.
P. Ragde, The parallel simplicity of compaction and chaining, J. Algorithms 14 (1993), 371–380.
U. Vishkin, Optimal parallel pattern matching in strings, Inform. and Control 67 (1985), 91–113.
U. Vishkin, Deterministic sampling-a new technique for fast pattern matching, SIAM J. Comput. 20 (1991), 22–40.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1994 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Gasieniec, L., Park, K. (1994). Work-time optimal parallel prefix matching. In: van Leeuwen, J. (eds) Algorithms — ESA '94. ESA 1994. Lecture Notes in Computer Science, vol 855. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0049432
Download citation
DOI: https://doi.org/10.1007/BFb0049432
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-58434-6
Online ISBN: 978-3-540-48794-4
eBook Packages: Springer Book Archive