Papers
Topics
Authors
Recent
Gemini 2.5 Flash
Gemini 2.5 Flash
126 tokens/sec
GPT-4o
47 tokens/sec
Gemini 2.5 Pro Pro
43 tokens/sec
o3 Pro
4 tokens/sec
GPT-4.1 Pro
47 tokens/sec
DeepSeek R1 via Azure Pro
28 tokens/sec
2000 character limit reached

A Fast Heuristic for Exact String Matching (1512.03512v1)

Published 11 Dec 2015 in cs.DS

Abstract: Given a pattern string $P$ of length $n$ consisting of $\delta$ distinct characters and a query string $T$ of length $m$, where the characters of $P$ and $T$ are drawn from an alphabet $\Sigma$ of size $\Delta$, the {\em exact string matching} problem consists of finding all occurrences of $P$ in $T$. For this problem, we present a randomized heuristic that in $O(n\delta)$ time preprocesses $P$ to identify $sparse(P)$, a rarely occurring substring of $P$, and then use it to find all occurrences of $P$ in $T$ efficiently. This heuristic has an expected search time of $O( \frac{m}{min(|sparse(P)|, \Delta)})$, where $|sparse(P)|$ is at least $\delta$. We also show that for a pattern string $P$ whose characters are chosen uniformly at random from an alphabet of size $\Delta$, $E[|sparse(P)|]$ is $\Omega(\Delta log (\frac{2\Delta}{2\Delta-\delta}))$.

Summary

We haven't generated a summary for this paper yet.