Professional Documents
Culture Documents
Graded Assignment-1
Rollno:-05
Batch:-A(1)
16/02/17
Q1. Design a Mealy machine with n states (N= (1 st Digit of DOB + 2nd Digit of DOB+ Month
of Birth) mod 10) with a, b as input characters and 0 & 1 as out parameters, convert the
same into a Moore Machine. Design the state diagram of both.
Ans:-
MEALY MACHINE:-
Present
Input =a Input=b
State
Next Output Next State Output
State
q1 q3 0 q2 0
q2 q1 1 q4 0
q3 q2 1 q1 1
q4 q4 1 q3 0
Step 1:- At the first stage we see into the next state column for any state like qi and determine
the number of different output associated with qi in that column.
Step 2:- Now we split qi, into the number of the such states, which are equal to the number of
different output associated with qi taking qi as the next state
In the above, q1 and q3 cannot be splitted because they have the same output for the given input
a and b.
But the states q2 and q4 have the different output for the given input a and b. So, we split q2 into
q20 and q21 And Similarly q4 is splitted into q40 and q41.
Present
Input =a Input=b
State
Next Output Next State Output
State
q1 q3 0 q2 0
q20 q1 1 q4 0
Q21 Q1 1 Q40 0
q3 q2 1 q1 1
q4 q4 1 q3 0
Q41 Q41 1 Q3 0
Step 3:- In the previous table , each state in the next column is associated with single output . We
reconstruct the table so that we have only one output column which show single output
associated with each state in the present state column.
Q0 Q3 Q20 0
Q1 Q3 Q20 1
Q20 Q1 Q40 0
Q21 Q1 Q40 1
Q3 Q21 Q1 0
Q40 Q41 Q3 0
Q41 Q41 Q3 1
Q2. Design an FA to parse an input string as 4 binary place of each of the last
4 digits of your enrollment. Find out of it is DFA or NDFA, if it is an NDFA
then convert it into a DFA. Also draw the transitional table and tuple set for
both (FA & DFA).
Ans:-
8:- 1000
2:-0010
1:-0001
0:-0000
TRANSITIONAL TABLE:-
State INPUT
0 1
Q0 Q0 Q1
Q1 Q2 Q1
Q2 Q3 Q0
Q3 Q1 Q3
Q0 1 Q1 0 Q2 0 Q3 0 Q1
Not Parseable
(ii) For String 2(0010):-
Q0 0 Q1 0 Q2 1 Q3 0 Q1
Parseable
Q0 0 Q1 0 Q2 0 Q3 1 Q1
Not Parseable
Q0 0 Q1 0 Q2 0 Q3 0 Q1
Not Parseable