### Abstract

Given a pattern string of length m for the string-matching problem, we design an algorithm that computes deterministic samples of a sufficiently long substring of the pattern in constant time. This problem used to be the bottleneck in the pattern preprocessing for one- and two-dimensional pattern matching. The best previous time bound was O(log^{2} m/ log log m). We use this algorithm to obtain the following results (all algorithms below are optimal parallel algorithms on a CRCW PRAM): 1. a deterministic string-matching algorithm which takes O(log log m) time for preprocessing and constant time for text search, which are the best possible in both preprocessing and text search; 2. a constant-time deterministic string-matching algorithm in the case where the text length n satisfies n = Ω(m^{1+ε}) for a constant ε > 0; 3. a simple string-matching algorithm that has constant time with high probability for random input; 4. the main result: a constant-expected-time Las Vegas algorithm for computing the period of the pattern and all witnesses and thus for string matching itself; in both cases, an Ω(log log m) lower bound is known for deterministic algorithms.

Original language | English (US) |
---|---|

Pages (from-to) | 950-960 |

Number of pages | 11 |

Journal | SIAM Journal on Computing |

Volume | 26 |

Issue number | 4 |

DOIs | |

State | Published - Aug 1997 |

Externally published | Yes |

### Fingerprint

### Keywords

- Deterministic samples
- Parallel string matching
- Randomized algorithms

### ASJC Scopus subject areas

- Computer Science(all)
- Mathematics(all)

### Cite this

*SIAM Journal on Computing*,

*26*(4), 950-960. https://doi.org/10.1137/S009753979528007X