Fast Algorithms for Exact String Matching
Abstract
Given a pattern string P of length n and a query string T of length m, where the characters of P and T are drawn from an alphabet of size , the exact string matching problem consists of finding all occurrences of P in T. For this problem, we present algorithms that in O(n2) time pre-process P to essentially identify sparse(P), a rarely occurring substring of P, and then use it to find occurrences of P in T efficiently. Our algorithms require a worst case search time of O(m), and expected search time of O(m/min(|sparse(P)|, )), where |sparse(P)| is at least δ (i.e. the number of distinct characters in P), and for most pattern strings it is observed to be (n1/2).
Turn this paper into a lesson
ArcXiv compiles a structured reading guide from this paper's metadata: plain-English importance, contributions, prerequisite concepts, which sections to read first, flashcards, and a quiz. Grounded in the abstract, never invented.