0% found this document useful (0 votes)
188 views

CS402 Assignment Solution

Uploaded by

shahbaz shahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
188 views

CS402 Assignment Solution

Uploaded by

shahbaz shahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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