<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
the	O
Commentz-Walter	B-Algorithm
algorithm	I-Algorithm
is	O
a	O
string	B-Algorithm
searching	I-Algorithm
algorithm	I-Algorithm
invented	O
by	O
Beate	O
Commentz-Walter	O
.	O
</s>
<s>
Like	O
the	O
Aho	B-Algorithm
–	I-Algorithm
Corasick	I-Algorithm
string	I-Algorithm
matching	I-Algorithm
algorithm	I-Algorithm
,	O
it	O
can	O
search	O
for	O
multiple	O
patterns	O
at	O
once	O
.	O
</s>
<s>
It	O
combines	O
ideas	O
from	O
Aho	O
–	O
Corasick	O
with	O
the	O
fast	O
matching	O
of	O
the	O
Boyer	B-Algorithm
–	I-Algorithm
Moore	I-Algorithm
string-search	I-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
GNU	B-Operating_System
grep	B-Application
once	O
implemented	O
a	O
string	B-Algorithm
matching	I-Algorithm
algorithm	I-Algorithm
very	O
similar	O
to	O
Commentz-Walter	O
.	O
</s>
<s>
The	O
paper	O
detailed	O
two	O
differing	O
algorithms	O
he	O
claimed	O
combined	O
the	O
idea	O
of	O
the	O
Aho-Corasick	B-Algorithm
and	O
Boyer-Moore	B-Algorithm
algorithms	I-Algorithm
,	O
which	O
he	O
called	O
algorithms	O
B	O
and	O
B1	O
.	O
</s>
<s>
The	O
Commentz-Walter	B-Algorithm
algorithm	I-Algorithm
combines	O
two	O
known	O
algorithms	O
in	O
order	O
to	O
attempt	O
to	O
better	O
address	O
the	O
multi-pattern	O
matching	O
problem	O
.	O
</s>
<s>
These	O
two	O
algorithms	O
are	O
the	O
Boyer-Moore	B-Algorithm
,	O
which	O
addresses	O
single	O
pattern	O
matching	O
using	O
filtering	O
,	O
and	O
the	O
Aho-Corasick	B-Algorithm
.	O
</s>
<s>
To	O
do	O
this	O
,	O
the	O
algorithm	O
implements	O
a	O
suffix	O
automaton	O
to	O
search	O
through	O
patterns	O
within	O
an	O
input	O
string	O
,	O
while	O
also	O
using	O
reverse	O
patterns	O
,	O
unlike	O
in	O
the	O
Aho-Corasick	B-Algorithm
.	O
</s>
<s>
For	O
the	O
first	O
phase	O
,	O
the	O
Commentz-Walter	B-Algorithm
algorithm	I-Algorithm
uses	O
a	O
reversed	O
pattern	O
to	O
build	O
a	O
pattern	O
tree	O
,	O
this	O
is	O
considered	O
the	O
pre-computing	O
phase	O
.	O
</s>
<s>
Using	O
the	O
Boyer-Moore	B-Algorithm
’	O
s	O
technique	O
of	O
shifting	O
and	O
the	O
Aho-Corasick	B-Algorithm
'	O
s	O
technique	O
of	O
finite	O
automata	O
,	O
the	O
Commentz-Walter	B-Algorithm
algorithm	I-Algorithm
can	O
begin	O
matching	O
.	O
</s>
<s>
The	O
Commentz-Walter	B-Algorithm
algorithm	I-Algorithm
will	O
scan	O
backwards	O
throughout	O
an	O
input	O
string	O
,	O
checking	O
for	O
a	O
mismatch	O
.	O
</s>
<s>
Comparing	O
the	O
Aho-Corasick	B-Algorithm
to	O
the	O
Commentz-Walter	B-Algorithm
Algorithm	I-Algorithm
yields	O
results	O
with	O
the	O
idea	O
of	O
time	O
complexity	O
.	O
</s>
<s>
Aho-Corasick	B-Algorithm
is	O
considered	O
linear	O
O( m+n+k	O
)	O
where	O
k	O
is	O
the	O
number	O
of	O
matches	O
.	O
</s>
<s>
The	O
reason	O
for	O
this	O
,	O
lies	O
in	O
the	O
fact	O
that	O
Commentz-Walter	O
was	O
developed	O
by	O
adding	O
the	O
shifts	O
within	O
the	O
Boyer	B-Algorithm
–	I-Algorithm
Moore	I-Algorithm
string-search	I-Algorithm
algorithm	I-Algorithm
to	O
the	O
Aho-Corasick	B-Algorithm
,	O
thus	O
moving	O
its	O
complexity	O
from	O
linear	O
to	O
quadratic	O
.	O
</s>
<s>
According	O
to	O
a	O
study	O
done	O
in	O
“	O
The	O
Journal	O
of	O
National	O
Science	O
Foundation	O
of	O
Sri	O
Lanka	O
46	O
”	O
Commentz-Walter	O
seems	O
to	O
be	O
generally	O
faster	O
than	O
the	O
Aho	B-Algorithm
–	I-Algorithm
Corasick	I-Algorithm
string	I-Algorithm
matching	I-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
As	O
seen	O
in	O
a	O
visualization	O
of	O
the	O
algorithm	O
’s	O
running	O
time	O
done	O
in	O
a	O
study	O
by	O
“	O
The	O
International	O
Journal	O
of	O
Advanced	O
Computer	B-General_Concept
Science	I-General_Concept
and	O
Information	O
Technology	O
”	O
the	O
performance	O
of	O
the	O
algorithm	O
increased	O
linearly	O
as	O
the	O
shortest	O
pattern	O
within	O
the	O
pattern	O
set	O
increased	O
.	O
</s>
<s>
This	O
algorithm	O
,	O
known	O
as	O
B1	O
,	O
operates	O
similarly	O
to	O
the	O
main	O
Commentz-Walter	B-Algorithm
algorithm	I-Algorithm
with	O
the	O
only	O
difference	O
being	O
in	O
the	O
way	O
the	O
pattern	O
tree	O
is	O
used	O
during	O
the	O
scanning	O
phase	O
.	O
</s>
