doc - Suraj @ LUMS

advertisement
Winter Quarter ‘03
CS311 - Automata and Complexity Theory
Assignment #2
Section I & II
Due Date: Tuesday 23 Dec, 2003
Total Marks: 100
Note: In each of the following questions, NFA refers to ε-NFA and/or NFA as defined in the
text book.
[Q1]
Construct an NFA with no more than five states for the set:
{ababn: n ≥ 0} U {aban: n ≥ 0}.
(6 marks)
[Q2]
Construct an NFA with three states that accepts the language {ab, abc}*.
(6 marks)
[Q3]
Give reasons why the last question cannot be solved with fewer than three states.
(6 marks)
[Q4]
Construct an NFA with four states for L = {an: n ≥ 0} U {bna: n ≥ 1}.
(6 marks)
[Q5]
Construct an NFA that accepts the set of strings of 0’s and 1’s such that there are two
0’s in the string that are separated by a number of positions that is a multiple of 4.
Note: 0 is an allowable multiple of 4.
(15 marks)
[Q6]
Convert the following NFA to DFA:
(15 marks)
1
Winter Quarter ‘03
[Q7]
Convert the following NFA to DFA:
(15 marks)
[Q8]
Prove that for every NFA with an arbitrary number of final states there is an
equivalent NFA with only one final state.
(6 marks)
[Q9]
Consider a DFA with the following transition table:
0
1
A
B
A
*B
C
A
C
C
C
->*
Informally describe the language accepted by this DFA, and prove by induction on
the length of an input string that your description is correct. Hint: When setting up
the inductive hypothesis, it is wise to make a statement about what inputs get you to
each state, not just what inputs get you to the accepting state.
(->: start state
*: accepting state)
(15 marks)
[Q10] Let L = {w | w contains an equal number of occurrences of the substring 01 and 10}.
Thus 101 is an element of L because 101 contains a single 01 and a single 10, but
1010 is not an element of L because is contains two 10s and one 01. Show that L is a
regular language (by constructing a DFA or an NFA).
(10 marks)
2
Download