You are on page 1of 3

Villaos, Jerico L.

BSCS 2B

A. L = { w/w contains the substancing 101 }


=>This language will generate string which start with any symbol ( 0/1 ) contains | 0 | ‘
somewhere in the middle and ends with any symbol ( 011 )
○ 1 0.1
A
A ¹ B º C ¹ D

0
Discription A is the start symbol on input ‘0’ doesent to maintain its states as any number of
‘0’ occur at the start of a string now, on input ‘1’, it will maintain its state to
B on input ‘0’ goes to state C as this 0 can be ‘0’ followed by the 1st 1’1 of the subtring ‘101’
now , on input ‘1’ B remains on P , as there can be any no. of 1’1 0 of which its last ‘1’ will
be treated as 1st ‘1’of the substring ‘101’
C On, input ‘0’ it goes to the start start state A as after getting ‘|0|’if we get ‘0’ again, then it
breaks the substring
Sequence ‘101’ that means we have to get the ‘101’ Sequence from the start again.
On input ’11 it goes to D as we get me substring ‘101’and our goal is achieved substring ‘101’
D . After getting substring ‘101’ any sequence of ‘0 1
Possible, so it remains on D after ‘0/1’ any of time

(B) L= { w/w ends in 001 }


=> this language will generate strings that contains of ‘0/1’ and ends with 001

1
A
A º B
A º C
A A
AA

10

Discription: A
A is the start state. On input ‘0’input ‘0’ goes to state B
A
As this ‘0’ may be 1st ‘0’ of the ‘001’ sequence
So, maintain this state at state AB
On, input ‘1’ at state AA , it doesent need to remember it
Cause, any on, of ‘1’ can happen at A A State and let ‘0’
has not been encountened for the sequence ‘001’ ;
B , on input ‘0’goes to c ,as its may be the and ‘0’ of the sequence 001
On input ‘1’ goes to A , cause ‘1’ breaks the sequence
‘001’ that was generating by 1st ‘0’,

C On input ‘ 0’ goes to B back, as, at C already 2 ‘0’


encountered, now again one ‘0’comes that makes last 20’s (‘0 0 ‘) form the ‘00’ of the
sequence ‘001’ at goes to final state D.

D this is final state, after being accepted, again if one ‘0’ comes, this has one ‘0’ at last of the
string so go to B . if one ‘1’ comes then it breaks the whole sequence and goes back to A
and start again.

C
A L = { w|w has a | in its and last position, if such

A.) Position

Now, generate some string form this L.


{ c,0,1,10,11,010,011,110,111, ˑˑˑ }

b.) if string ≤ 1, t h en t h ere∈no∧last possition


so, ∈(empty string) 0.1, accepted
c.) for string ≥ t h ere is∧last possition , so , we have to maintain it.

DFA

0 0

A B D E F
0 A 1
A A 1 A

A
A 1
1
C
A
1 0

A Start state
A , B , C F final state

1.) ∈in accepted, A final state


2.) Singel‘ 0 ‘ / ‘ 1 ‘ is a, so B C Finalstate
3.) Now, at B if one ‘ o ‘ occurs go to D mark that first ‘0’
Single ‘0’ and this ‘o’ in not one, this implied string
Height 2.2 at B if ‘1 ‘ in input remember this ‘ 1 ‘ as this
May be the and last ‘1’, and go to F
4.) A (c) Any no, of I can occur, as and last symbol will bel
Then if ‘ o ‘ is infiruity then go the F final state
Last is still ‘ 1 ‘ .
5.) ‘D’ to remember any accurance of ‘0’ and if ‘1’ comes remember the state at E
6.) One ‘ 1 ‘ occurred then if ‘0’ is input and is still ‘ 1’ do, go to F and if ‘1’ in input then go
to ‘ C ‘
7.) At F , if ‘o’ occurred go to D to maintain the O’s if ‘1 )
occurred, then remember ‘ 1 ‘ and got E

You might also like