Theory of Automata (CS402)
Assignment # 01
Spring 2024
Student ID: BC 210210543
Student Name
Question No 01 Marks: 3+3+3 = 9
Consider the language L of strings, defined over ∑= {a, b}, Write regular expressions of following:
a. Strings starting with “b” and ending with “a” having “ab” as a substring.
Answer:
So, the regular expression for the language 𝐿 is:
Regular Expression: b(ab)*a
𝑏 (Σ∗) 𝑎𝑏 (Σ∗) 𝑎
In simpler terms, the regular expression can be written as: 𝑏𝑎𝑏 (Σ∗) 𝑎
This regular expression describes all strings in the language 𝐿
that start with "b," end with "a," and have "ab" as a substring.
b. Strings containing even number of a’s and ending with “baba” or “bb”.
Answer:
Regular Expression:
((b+ab+aab)∗(bb+baba))
Let's break down this regular expression:
(𝑏+𝑎𝑏+𝑎𝑎𝑏)∗: This part allows for any combination of "b," "ab," or "aab" repeated zero or more times,
ensuring an even number of "a's."
(𝑏𝑏+𝑏𝑎𝑏𝑎): This part specifies that the string must end with either "bb" or "baba."
c. String that having NULL or starts with “a” and having no consecutive b’s in it.
Answer:
Regular Expression:
𝑎+𝜖: Represents strings that start with "a" or are empty.
Here's a breakdown:
𝑏𝑎∗+𝜖: Represents strings that have no consecutive "b's."
This expression covers all cases where the string can be empty or start with "a" and have no
consecutive "b's."
Question No 2: Marks: 11
Construct a Deterministic Finite Automata (DFA) for part C of Question 1.