

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: ORGNZTN PROGM LANG; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Be sure to give a DFA for each part, and not an NFA unless the problem asks for one. Do not use any notational conveniences or shortcuts given in lecture.
The notation #a(w) is used below to refer to the number of a’s occurring in the string w. For example, #a(bbaba) = 2.
Note: the first seven parts are the same languages which were questions on Homework #1. It would be very instructive to compare the DFA and the regular expression for these languages– it is suggested that you do so.
a. { w | w begins with abab }
b. { w | w ends with abab }
c. { w | w begins with ab and ends with ba } Note: The string aba is in this language.
d. { w | #a(w) ≡ 2 (mod 5) } Recall that i ≡ j (mod k) if and only if i − j is divisible by k.
e. { w | #a(w) is even or |w| is even }
f. { w | aaa is a substring of w }
g. { w | aaa is not a substring of w }
h. { w | w contains exactly one occurrence of the substring aaa } Note: the string aaaa has two occurrences of aaa.
i. { w | either #a(w) is divisible by 3 or w begins with bbb } Also write a regular expression which describes or recognizes this language.
j. { w | #a(w) ≡ 1 (mod 3) and #b(w) is odd }
k. { w | neither aa nor bb is a substring of w }
l. Write an NFA for the language in part #1i.
{ w | w ∈ { 0 , 1 }∗^ and w contains an even number of 0s, and w does not contain three consecutive 1s }
Determine whether each of the following DFAs correctly describes or recognizes this language or not. Identify why each incorrect DFA is wrong– give a string which the DFA doesn’t give the right results for, and identify what result the DFA should give for that string, and what result it actually gives.
a. dead state
b.
dead state
c. dead state
d. dead state
e. dead state