edited by
238 views

2 Answers

0 votes
0 votes

You can create states using all the possibilities i.e,

S1 : (Seen even 0s, Seen zero 1s) Will be initial state as in empty string there are zeros 1s and even 0s

S2: (Seen odd 0s, Seen zero 1s)

S3: (Seen even 0s, Seen one 1s)

S4: (Seen odd 0s, Seen one 1s)

S5: (Seen even 0s, Seen two 1s)

S6: (Seen odd 0s, Seen two 1s)

S7: (Seen even 0s, Seen more than two 1s)

S8: (Seen odd 0s, Seen more than two 1s)

 

Then you can add transitions appropriately, and make the states you want as final

 

For even number of 0s and exactly two 1s, the only possibility is in {S5}. (S7 and S8 can be joined in one possibility in this case)

For even number of 0s or exactly two ones, the possibility is in

Possibility if even zeros : {S1, S3, S5, S7}

Possibility of exactly two 1s: {S5, S6}

So the union of these will be the final states

 

Edit: There will be a self loop in S8 on input 1

edited by

Related questions

122
views
1 answers
0 votes
Dknights asked Jan 8
122 views
a^n ww^r a^n .. (n>=0, w belongs to (a,b)*)Can someone please explain the flow how we will process the language in CFL.
708
views
1 answers
0 votes
Sunnidhya Roy asked Dec 12, 2022
708 views
L = {0^n 1^2n 0^n+m , n,m>=0}Is this Language CFL or non CFL?According to mewe can write this as 0^n 1^n 1^n 0^n 0^mThen we will keep on ... and when we reach the end of the string we simply move to the final state.Is this logic correct?
417
views
0 answers
2 votes
Sunnidhya Roy asked Dec 11, 2022
417 views
Suppose L1 = CFL and L2 = Regular, We are to find out whether L1 - L2 = CFL or non CFL.I have 2 approaches to this question and I am confused ... Language is also CFL so CFL intersection CFL = non CFL.Can somebody please clarify my doubt?
623
views
1 answers
1 votes
samarpita asked Nov 21, 2021
623 views
What will be the answer