What will be the DFA for the regular expression 0(0+1)*0+1(0+1)*1?

后端 未结 2 2018
挽巷
挽巷 2020-12-04 02:58

This is the DFA i have drawn-

\"MyDFA\"

Is it correct?
I am confused because q4 state

相关标签:
2条回答
  • 2020-12-04 03:29

    I think you should start with 0 first

    0(1 + 0)*0 + 1(1 + 0)*1
    

    0 讨论(0)
  • 2020-12-04 03:50

    Your DFA is not correct.
    your DFA is completely wrong so I don't comment

    DFA for RE:

    0(1 + 0)*0 + 1(1 + 0)*1  
    

    Language Description: if string start with 0 it should end with 0 or if string start with 1 it should end with 1. hence two final states (state-5, state-4).

    state-4 : accepts 1(1 + 0)*1
    state-5 : accepts 0(1 + 0)*0
    state-1 : start state.

    DFA:

    DFA

    EDIT :

    + Operator in Regular Expression

    (0 + 1)* = (1 + 0)* that is any string consist of 1s and 0s, including Null string ^.

    Here + means Union if it appear between two RE: and A U B = B U A (similarly)=> (0 + 1) = (0 + 1) .

    meaning of plus + depends on syntax it appears in: If expression is a+ (+ is superscripted) this means one of more as, and If a+b then + means Union operation either a or b.

    a+ : { a, aa, aaa, aaa.....} that is any number of a string in language with length > 1.

    0 讨论(0)
提交回复
热议问题