Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

CS402 Assignment Solution;

Question 1:
a. Regular expression for strings starting with “b” and ending with “a” having “ab” as a
substring:
b(ab)*a
b. Regular expression for strings containing even number of a’s and ending with “baba” or
“bb”:
(b|a(aa)* baba|a(aa)*bb)
c. Regular expression for strings that have NULL or start with “a” and have no consecutive
b’s:
(ε|a|(ab)*a)
Question 2:
Constructing a Deterministic Finite Automata (DFA) for part c of Question 1 involves designing
a state diagram with states representing different conditions of the string. I can provide you with
a textual description of the DFA or a state transition table. Which one would you prefer?

You might also like