[英]Draw an FSA that recognizes: (A∗ | AB+). (The bar outscopes the other operators, so its equal to: (A∗) | (AB+).) Use as few states possible
I've attached what I have.我已经附上了我所拥有的。 My problem is that I don't know if its correct and if I've even used the fewest states possible to answer this question.我的问题是我不知道它是否正确,以及我是否使用了尽可能少的状态来回答这个问题。 Really appreciate any help on what I currently did wrong this is what i have currently非常感谢对我目前做错的任何帮助这是我目前所拥有的
I would start by creating two FSAs, one for each of the branches.我将首先创建两个 FSA,每个分支一个。
For A*
you only need one state.对于A*
,您只需要一个 state。
For AB+
you need three states.对于AB+
,您需要三个状态。
Then you merge the two.然后你合并两者。 Assuming it does not have to be deterministic, the total FSA ends up with three states as well, two of which are final states.假设它不一定是确定性的,那么整个 FSA 最终也会有三个状态,其中两个是最终状态。
As you tagged your question dfa
— a deterministic FSA would need 4 states in total:当您标记您的问题dfa
时——确定性 FSA 总共需要 4 个状态:
Start state: 1;启动 state:1; Final States: 1,2,3,4最终状态:1,2,3,4
Transitions:过渡:
1 - a -> 2 1 - 一个 -> 2
2 - a -> 4 2 - 一个 -> 4
2 - b -> 3 2 - b -> 3
3 - b -> 3 3 - b -> 3
4 - a -> 4 4 - 一个 -> 4
That is a DFA that recognises (a*|ab+):这是一个识别 (a*|ab+) 的 DFA:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.