3

I have recently learned about using powerset construction for conversion of NFA to DFA - however this only seems to be feasible when the number of states we are working with are 3 or less, as $2^k$ seems to grow unmanageable very quickly.

I have a problem with 6 states, meaning that if I were to use powerset construction, I would have 64 states. What is a more efficient way?

Gilles 'SO- stop being evil'
  • 43,613
  • 8
  • 118
  • 182

2 Answers2

6

Let me mention a variant of the powerset construction. In this variant, we are going to construct only states reachable from the initial state. The way it works is as follows:

  1. Create a list of states to-be-processed, and populate it initially with $\{q_0\}$, where $q_0$ is the initial state of the NFA.

  2. While the to-be-processed list is non-empty, remove a state $S$, and compute all states reachable from $S$ by reading one character. Put any of these which hasn't been encountered yet in the to-be-processed list.

This variant (which I haven't quite specified in full) constructs the powerset automaton restricted to states reachable from the (new) initial state, and runs in time proportional to the resulting number of states (and the alphabet size).

The same construction, and indeed the vanilla powerset construction, also works for NFAs with several initial states. The only difference is that we start with the set $Q_0$ of initial states (which is also going to be the initial state of the resulting DFA) rather than with $\{q_0\}$.

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
0

In addition to the strategies pointed out in other answers , You can also adopt the method of directly constructing a DFA by determining the number of equivalence classes for your problem which is equal to the number of states in your minimized automaton. However this approach is suitable for problems having few partitions for the strings but produces the results quicker relative to other methods.

Shubham Singh rawat
  • 634
  • 1
  • 4
  • 11