Computing Atlas

How Computing Was Built
Sign In
Text size
100%
Theme
Algorithm

Commentz-Walter algorithm

String Algorithm

The Commentz-Walter algorithm is a string searching algorithm that looks for several patterns in a text at once. It was invented by Beate Commentz-Walter, whose paper was first published through Saarland University in 1979. It combines the multi-pattern automaton idea of the Aho-Corasick algorithm with the backward scanning and large shifts of the Boyer-Moore algorithm. In a precomputation phase a pattern tree is built from the reversed patterns, and in the matching phase the text is scanned backwards, with a shift table telling how far to move after a mismatch. For a text of length n and a longest pattern of length m the worst-case running time is O(mn), which it inherits from Boyer-Moore, although the average case is often much better and with few matches both this method and Aho-Corasick approach linear time. Published analyses suggest it can beat Aho-Corasick when the patterns are long, but the source notes that there is no general agreement on that. GNU grep once used a very similar algorithm.

Facts
Time Complexity
Time Complexity (category)
Polynomial Time -- O(n^k) 1
Connections

Credited To

Source Commentz-Walter algorithm (Wikipedia)

In Field

Source Commentz-Walter algorithm (Wikipedia)

Invented

Source Commentz-Walter algorithm (Wikipedia)
Sources
1. Commentz-Walter algorithm (Wikipedia)
  • Lead paragraph [complexity-category]
    its worst-case running time is O(mn)
  • In Group: String Searching Algorithms, Lead paragraph
    the Commentz-Walter algorithm is a string searching algorithm invented by Beate Commentz-Walter
  • In Field: Algorithms and Complexity Theory, Lead paragraph [in-field]
    the Commentz-Walter algorithm is a string searching algorithm
  • Credited To: Beate Commentz-Walter, Lead paragraph
    the Commentz-Walter algorithm is a string searching algorithm invented by Beate Commentz-Walter
  • Invented: Beate Commentz-Walter, Lead paragraph
    the Commentz-Walter algorithm is a string searching algorithm invented by Beate Commentz-Walter
View the Source
Comments (0)
No comments yet. Be the first to share a thought.
Reader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.