How can you construct an NFA with k+2 states, where k is an arbitrary natural?

131 Views Asked by At

I was asked this question and couldn't come up with an answer?

If I had a language $X = \sum^{*} a \sum^{k}$ where $k$ is an arbitrary natural number (the language where the $k+1$'st to last letter is an $a$. My question is: how can you design the NFA of this language, when you do not know what the value of $k$ is. It might be possible that the NFA changes whenever $k$ changes.

1

There are 1 best solutions below

0
On

Consider the following NFA.

enter image description here

This NFA accepts exactly the strings $\Sigma^*a\Sigma^k$.