<s>
In	O
automata	B-Application
theory	I-Application
(	O
a	O
branch	O
of	O
theoretical	O
computer	O
science	O
)	O
,	O
DFA	B-General_Concept
minimization	I-General_Concept
is	O
the	O
task	O
of	O
transforming	O
a	O
given	O
deterministic	B-General_Concept
finite	I-General_Concept
automaton	I-General_Concept
(	O
DFA	B-General_Concept
)	O
into	O
an	O
equivalent	O
DFA	B-General_Concept
that	O
has	O
a	O
minimum	O
number	O
of	O
states	O
.	O
</s>
<s>
Here	O
,	O
two	O
DFAs	B-General_Concept
are	O
called	O
equivalent	O
if	O
they	O
recognize	O
the	O
same	O
regular	B-General_Concept
language	I-General_Concept
.	O
</s>
<s>
Several	O
different	O
algorithms	O
accomplishing	O
this	O
task	O
are	O
known	O
and	O
described	O
in	O
standard	O
textbooks	O
on	O
automata	B-Application
theory	I-Application
.	O
</s>
<s>
For	O
each	O
regular	B-General_Concept
language	I-General_Concept
,	O
there	O
also	O
exists	O
a	O
minimal	O
automaton	O
that	O
accepts	O
it	O
,	O
that	O
is	O
,	O
a	O
DFA	B-General_Concept
with	O
a	O
minimum	O
number	O
of	O
states	O
and	O
this	O
DFA	B-General_Concept
is	O
unique	O
(	O
except	O
that	O
states	O
can	O
be	O
given	O
different	O
names	O
)	O
.	O
</s>
<s>
The	O
minimal	B-General_Concept
DFA	I-General_Concept
ensures	O
minimal	O
computational	O
cost	O
for	O
tasks	O
such	O
as	O
pattern	B-Language
matching	I-Language
.	O
</s>
<s>
There	O
are	O
two	O
classes	O
of	O
states	O
that	O
can	O
be	O
removed	O
or	O
merged	O
from	O
the	O
original	O
DFA	B-General_Concept
without	O
affecting	O
the	O
language	O
it	O
accepts	O
.	O
</s>
<s>
Unreachable	O
states	O
are	O
the	O
states	O
that	O
are	O
not	O
reachable	O
from	O
the	O
initial	O
state	O
of	O
the	O
DFA	B-General_Concept
,	O
for	O
any	O
input	O
string	O
.	O
</s>
<s>
DFA	B-General_Concept
minimization	I-General_Concept
is	O
usually	O
done	O
in	O
three	O
steps	O
:	O
</s>
<s>
optionally	O
,	O
re-create	O
a	O
single	O
dead	O
state	O
(	O
"	O
sink	O
"	O
state	O
)	O
if	O
the	O
resulting	O
DFA	B-General_Concept
is	O
required	O
to	O
be	O
complete	O
.	O
</s>
<s>
The	O
state	O
of	O
a	O
deterministic	B-General_Concept
finite	I-General_Concept
automaton	I-General_Concept
is	O
unreachable	O
if	O
no	O
string	O
in	O
exists	O
for	O
which	O
.	O
</s>
<s>
Unreachable	O
states	O
can	O
be	O
removed	O
from	O
the	O
DFA	B-General_Concept
without	O
affecting	O
the	O
language	O
that	O
it	O
accepts	O
.	O
</s>
<s>
One	O
algorithm	O
for	O
merging	O
the	O
nondistinguishable	O
states	O
of	O
a	O
DFA	B-General_Concept
,	O
due	O
to	O
,	O
is	O
based	O
on	O
partition	B-Data_Structure
refinement	I-Data_Structure
,	O
partitioning	O
the	O
DFA	B-General_Concept
states	O
into	O
groups	O
by	O
their	O
behavior	O
.	O
</s>
<s>
The	O
following	O
pseudocode	B-Language
describes	O
the	O
form	O
of	O
the	O
algorithm	O
as	O
given	O
by	O
Xu	O
.	O
</s>
<s>
The	O
worst	B-General_Concept
case	I-General_Concept
running	O
time	O
of	O
this	O
algorithm	O
is	O
,	O
where	O
is	O
the	O
number	O
of	O
states	O
and	O
is	O
the	O
size	O
of	O
the	O
alphabet	O
.	O
</s>
<s>
The	O
partition	B-Data_Structure
refinement	I-Data_Structure
data	O
structure	O
allows	O
each	O
splitting	O
step	O
to	O
be	O
performed	O
in	O
time	O
proportional	O
to	O
the	O
number	O
of	O
transitions	O
that	O
participate	O
in	O
it	O
.	O
</s>
<s>
This	O
remains	O
the	O
most	O
efficient	O
algorithm	O
known	O
for	O
solving	O
the	O
problem	O
,	O
and	O
for	O
certain	O
distributions	O
of	O
inputs	O
its	O
average-case	B-General_Concept
complexity	O
is	O
even	O
better	O
,	O
.	O
</s>
<s>
Once	O
Hopcroft	O
's	O
algorithm	O
has	O
been	O
used	O
to	O
group	O
the	O
states	O
of	O
the	O
input	O
DFA	B-General_Concept
into	O
equivalence	O
classes	O
,	O
the	O
minimum	O
DFA	B-General_Concept
can	O
be	O
constructed	O
by	O
forming	O
one	O
state	O
for	O
each	O
equivalence	O
class	O
.	O
</s>
<s>
If	O
is	O
a	O
set	O
of	O
states	O
in	O
,	O
is	O
a	O
state	O
in	O
,	O
and	O
is	O
an	O
input	O
character	O
,	O
then	O
the	O
transition	O
in	O
the	O
minimum	O
DFA	B-General_Concept
from	O
the	O
state	O
for	O
,	O
on	O
input	O
,	O
goes	O
to	O
the	O
set	O
containing	O
the	O
state	O
that	O
the	O
input	O
automaton	O
would	O
go	O
to	O
from	O
state	O
on	O
input	O
.	O
</s>
<s>
The	O
initial	O
state	O
of	O
the	O
minimum	O
DFA	B-General_Concept
is	O
the	O
one	O
containing	O
the	O
initial	O
state	O
of	O
the	O
input	O
DFA	B-General_Concept
,	O
and	O
the	O
accepting	O
states	O
of	O
the	O
minimum	O
DFA	B-General_Concept
are	O
the	O
ones	O
whose	O
members	O
are	O
accepting	O
states	O
of	O
the	O
input	O
DFA	B-General_Concept
.	O
</s>
<s>
Moore	O
's	O
algorithm	O
for	O
DFA	B-General_Concept
minimization	I-General_Concept
is	O
due	O
to	O
.	O
</s>
<s>
Its	O
worst-case	B-General_Concept
time	O
complexity	O
is	O
:	O
each	O
step	O
of	O
the	O
algorithm	O
may	O
be	O
performed	O
in	O
time	O
using	O
a	O
variant	O
of	O
radix	B-Algorithm
sort	I-Algorithm
to	O
reorder	O
the	O
states	O
so	O
that	O
states	O
in	O
the	O
same	O
set	O
of	O
the	O
new	O
partition	O
are	O
consecutive	O
in	O
the	O
ordering	O
,	O
and	O
there	O
are	O
at	O
most	O
steps	O
since	O
each	O
one	O
but	O
the	O
last	O
increases	O
the	O
number	O
of	O
sets	O
in	O
the	O
partition	O
.	O
</s>
<s>
The	O
instances	O
of	O
the	O
DFA	B-General_Concept
minimization	I-General_Concept
problem	O
that	O
cause	O
the	O
worst-case	B-General_Concept
behavior	O
are	O
the	O
same	O
as	O
for	O
Hopcroft	O
's	O
algorithm	O
.	O
</s>
<s>
The	O
number	O
of	O
steps	O
that	O
the	O
algorithm	O
performs	O
can	O
be	O
much	O
smaller	O
than	O
,	O
so	O
on	O
average	O
(	O
for	O
constant	O
)	O
its	O
performance	O
is	O
or	O
even	O
depending	O
on	O
the	O
random	O
distribution	O
on	O
automata	O
chosen	O
to	O
model	O
the	O
algorithm	O
's	O
average-case	B-General_Concept
behavior	O
.	O
</s>
<s>
Reversing	O
the	O
transitions	O
of	O
a	O
non-deterministic	B-General_Concept
finite	I-General_Concept
automaton	I-General_Concept
(	O
NFA	O
)	O
and	O
switching	O
initial	O
and	O
final	O
states	O
produces	O
an	O
NFA	O
for	O
the	O
reversal	O
of	O
the	O
original	O
language	O
.	O
</s>
<s>
Converting	O
this	O
NFA	O
to	O
a	O
DFA	B-General_Concept
using	O
the	O
standard	O
powerset	B-General_Concept
construction	I-General_Concept
(	O
keeping	O
only	O
the	O
reachable	O
states	O
of	O
the	O
converted	O
DFA	B-General_Concept
)	O
leads	O
to	O
a	O
DFA	B-General_Concept
for	O
the	O
same	O
reversed	O
language	O
.	O
</s>
<s>
As	O
observed	O
,	O
repeating	O
this	O
reversal	O
and	O
determinization	B-General_Concept
a	O
second	O
time	O
,	O
again	O
keeping	O
only	O
reachable	O
states	O
,	O
produces	O
the	O
minimal	B-General_Concept
DFA	I-General_Concept
for	O
the	O
original	O
language	O
.	O
</s>
<s>
The	O
intuition	O
behind	O
the	O
algorithm	O
is	O
this	O
:	O
determinizing	O
the	O
reverse	O
automaton	O
merges	O
states	O
that	O
are	O
nondistinguishable	O
in	O
the	O
original	O
automaton	O
,	O
but	O
may	O
merge	O
also	O
states	O
that	O
should	O
not	O
be	O
merged	O
(	O
i.e.	O
,	O
are	O
not	O
merged	O
in	O
the	O
minimal	B-General_Concept
DFA	I-General_Concept
)	O
.	O
</s>
<s>
That	O
is	O
why	O
we	O
need	O
to	O
determinize	O
it	O
again	O
,	O
obtaining	O
the	O
minimal	B-General_Concept
DFA	I-General_Concept
.	O
</s>
<s>
The	O
determinization	B-General_Concept
of	O
then	O
creates	O
powerstates	O
(	O
sets	O
of	O
states	O
of	O
)	O
,	O
where	O
every	O
two	O
powerstates	O
differ	O
‒	O
naturally	O
‒	O
in	O
at	O
least	O
one	O
state	O
of	O
.	O
</s>
<s>
Therefore	O
,	O
after	O
determinization	B-General_Concept
of	O
,	O
we	O
have	O
a	O
DFA	B-General_Concept
with	O
no	O
indistinguishable	O
or	O
unreachable	O
states	O
;	O
hence	O
,	O
the	O
minimal	B-General_Concept
DFA	I-General_Concept
for	O
the	O
original	O
.	O
</s>
<s>
We	O
reverse	O
and	O
determinize	O
to	O
obtain	O
,	O
which	O
is	O
the	O
minimal	B-General_Concept
DFA	I-General_Concept
for	O
the	O
reversal	O
of	O
the	O
language	O
of	O
(	O
since	O
we	O
did	O
only	O
one	O
reversal	O
so	O
far	O
)	O
.	O
</s>
<s>
Now	O
all	O
that	O
's	O
left	O
to	O
do	O
is	O
to	O
reverse	O
to	O
obtain	O
the	O
minimal	B-General_Concept
DFA	I-General_Concept
for	O
the	O
original	O
language	O
.	O
</s>
<s>
The	O
worst-case	B-General_Concept
complexity	O
of	O
Brzozowski	O
's	O
algorithm	O
is	O
exponential	O
in	O
the	O
number	O
of	O
states	O
of	O
the	O
input	O
automaton	O
.	O
</s>
<s>
This	O
holds	O
regardless	O
of	O
whether	O
the	O
input	O
is	O
a	O
NFA	O
or	O
a	O
DFA	B-General_Concept
.	O
</s>
<s>
In	O
the	O
case	O
of	O
DFA	B-General_Concept
,	O
the	O
exponential	O
explosion	O
can	O
happen	O
during	O
determinization	B-General_Concept
of	O
the	O
reversal	O
of	O
the	O
input	O
automaton	O
;	O
in	O
the	O
case	O
of	O
NFA	O
,	O
it	O
can	O
also	O
happen	O
during	O
the	O
initial	O
determinization	B-General_Concept
of	O
the	O
input	O
automaton	O
.	O
</s>
<s>
However	O
,	O
the	O
algorithm	O
frequently	O
performs	O
better	O
than	O
this	O
worst	B-General_Concept
case	I-General_Concept
would	O
suggest	O
.	O
</s>
<s>
While	O
the	O
above	O
procedures	O
work	O
for	O
DFAs	B-General_Concept
,	O
the	O
method	O
of	O
partitioning	O
does	O
not	O
work	O
for	O
non-deterministic	B-General_Concept
finite	I-General_Concept
automata	I-General_Concept
(	O
NFAs	O
)	O
.	O
</s>
<s>
However	O
,	O
there	O
are	O
methods	O
of	O
NFA	B-General_Concept
minimization	I-General_Concept
that	O
may	O
be	O
more	O
efficient	O
than	O
brute	O
force	O
search	O
.	O
</s>
