You are on page 1of 3

CSC3113: Theory of Computation

Midsemester Assignment

1. Consider the following state diagram S1 for the DFA D1.

a) Give the formal definition of DFA D1, with the five tuples for the above diagram. 2
b) State the language, A1, for D1. 1

2. Consider the following language for DFA D2 where, ∑ = { 0, 1 } –


A2(a) = {w | w does not contain the substring 110}
A2(b)= {w | w does not contain the substring 100}
A2(c)= {w | w does not contain the substring 010}
A2(d)= {w | w does not contain the substring 111}
A2(e)= {w | w starts with 1 and has odd length}
A2(f)= {w | w ends with 0 and has even length}
A2(g)= {w | w starts with 1 and has at most one 0}
A2(h)= {w | w starts with 0 and has at least two 1s}
A2(i)= {w | w has odd number of 0s, followed by at least one 1}
A2(j)= {w | w starts with 1 and does not contain the substring 00}
A2(k)= {w | w starts with 0 and does not contain the substring 01}
A2(l)= {w | w ends with 0 and does not contain the substring 11}
A2(m)= {w | w ends with 1 and contain the substring 10}
A2(n)= {w | Length of w is at least two and 2nd symbol is 0}
A2(o)= {w | Every odd position of w has symbol 1}
A2(p)= {w | Every even position of w has symbol 0}
A2 (q)= {w | w ends with 00}
A2 (r)= {w | w ends with 10}
A2 (s)= {w | w starts with 11}
A2 (t)= {w | w starts with 01}
a) Draw the state diagram for the language A2. 4
b) Give formal definition for this DFA, D2, with the five tuples. 2

CSC3113: Theory of Computation, Assignment 01 Page 1 of 3


3. Perform the regular operation Union (U), for the DFAs D1 and D2.
a) Show the Transition table and mark the start and final states. 4
b) Draw the state diagram from the transition table. 5

4. Consider the language A1 for NFA N1 where, ∑ = { 0, 1 }.


a) Draw the state diagram for the language A1. 3
b) Give formal definition for the NFA N1 of language A1. 2

5. Consider the following language for NFA N3 where, ∑ = { 0, 1 }


A3(a) = {w | w does not contain the substring 110}
A3(b) = {w | w does not contain the substring 100}
A3(c) = {w | w does not contain the substring 010}
A3(d) = {w | w does not contain the substring 111}
A3(e) = {w | w starts with 1 and has odd length}
A3(f) = {w | w ends with 0 and has even length}
A3(g) = {w | w starts with 1 and has at most one 0}
A3(h) = {w | w starts with 0 and has at least two 1s}
A3(i) = {w | w has odd number of 0s, followed by at least one 1}
A3(j) = {w | w starts with 1 and does not contain the substring 00}
A3(k) = {w | w starts with 0 and does not contain the substring 01}
A3(l) = {w | w ends with 0 and does not contain the substring 11}
A3(m) = {w | w ends with 1 and contain the substring 10}
A3(n) = {w | Length of w is at least two and 2nd symbol is 0}
A3(o) = {w | Every odd position of w has symbol 1}
A3(p) = {w | Every even position of w has symbol 0}
A3(q) = {w | w ends with 00}
A3(r) = {w | w ends with 10}
A3(s) = {w | w starts with 11}
A3(t) = {w | w starts with 01}
a) Draw the state diagram for the language A3. 3
b) Give formal definition for the NFA N3 of language A3. 2

6. Convert the NFA N3 to its equivalent DFA. 4+5

7. Perform the following regular operations on the NFAs N1 and N3.


a) Draw the state diagram for the Union of the NFAs N1 and N3. 2
b) Draw the state diagram for the Concatenation of the NFAs N1 followed by N3. 2
c) Draw the state diagram for the Star of the NFA N1. 2

8. Use ONLY your student ID to answer the following questions.


a) Take your student ID and get the middle (5 digit) part within the hyphens. 1
[example: 18-49036-3 → 49036].
Now, divide each 5 digits of this middle part by 2 individually and get the 5
remainders from left to right.

CSC3113: Theory of Computation, Assignment 01 Page 2 of 3


→ →
[example: 49036 4%2, 9%2, 0%2, 3%2, 6%2 0, 1, 0, 1, 0]
Then put the 5 remainders together as a number consecutively, from left to right.
[example: 0, 1, 0, 1, 0
→ 01010]
b) Use the answer from 8.a) as input to the state diagram for the Concatenation of the 6 NFAs
N1 followed by N3, answered in question 7.b). 6

CSC3113: Theory of Computation, Assignment 01 Page 3 of 3

You might also like