Skip to search boxSkip to navigationSkip to main content

Towards optimal packed string matching

  • Oren Ben-Kiki
    ,
  • Philip Bille
    ,
  • Dany Breslauer
    ,
  • Leszek Ga̧sieniec
    ,
  • Roberto Grossi
    ,
  • Oren Weimann(corresponding author)
*Corresponding author for this work
  • Intel
    ,
  • Technical University of Denmark
    ,
  • University of Haifa
    ,
  • University of Liverpool
    ,
  • University of Pisa
Scholary Output:
Contribution to journal
Article
Research
Peer-review

Open access

Abstract

In the packed string matching problem, it is assumed that each machine word can accommodate up to α characters, thus an n-character string occupies n/α memory words. (a) We extend the Crochemore-Perrin constant-space O(n)-time string-matching algorithm to run in optimal O(n/α) time and even in real-time, achieving a factor α speedup over traditional algorithms that examine each character individually. Our macro-level algorithm only uses the standard AC0 instructions of the word-RAM model (i.e. no integer multiplication) plus two specialized micro-level AC0 word-size packed-string instructions. The main word-size string-matching instruction wssm is available in contemporary commodity processors. The other word-size maximum-suffix instruction wslm is only required during the pattern pre-processing. Benchmarks show that our solution can be efficiently implemented, unlike some prior theoretical packed string matching work. (b) We also consider the complexity of the packed string matching problem in the classical word-RAM model in the absence of the specialized micro-level instructions wssm and wslm. We propose micro-level algorithms for the theoretically efficient emulation using parallel algorithms techniques to emulate wssm and using the Four-Russians technique to emulate wslm. Surprisingly, our bit-parallel emulation of wssm also leads to a new simplified parallel random access machine string-matching algorithm. As a byproduct to facilitate our results we develop a new algorithm for finding the leftmost (most significant) 1 bits in consecutive non-overlapping blocks of uniform size inside a word. This latter problem is not known to be reducible to finding the rightmost 1, which can be easily solved, since we do not know how to reverse the bits of a word in O(1) time.

Publication Information

Output type

Scholary Output:
Contribution to journal
Article
Research
Peer-review

Original language

English (US)

Pages from-to (Number of pages)

Pages 111-129 (19 pages)

Journal (Volume, Issue Number)

Theoretical Computer Science (Volume 525)

Publication milestones

  • Published - 03/13/2014

Publication status

Published - 03/13/2014

ISSN

0304-3975

Publication IDs

  • Scopus: 84895927769

Publication metrics

Metrics

Fractional count
1
Fractional count
0.17
Fractional count
5
Fractional count
0.83
Fractional count
1
Fractional count
1
Scopus
citations
SciVal
citations
6
SciVal
FWCI
1.17
SciVal
Author count
6
SciVal
Paper percentile
57

PlumX, opens in new tab

Captures
17
Citation count
19

Funding Details

* Corresponding author. E-mail address: [email protected] (O. Weimann). 1 Partially supported by the European Research Council (ERC) Project SFEROT and by the Israeli Science Foundation Grants 686/07, 347/09 and 864/11. 2 Partially supported by Italian project PRIN AlgoDEEP (2008TFBWL4) of MIUR.
FundersFunding numbers
ERC
-
MIUR
-
ISF
2008TFBWL4, 686/07, 864/11, 347/09