Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
14 views2 pages

CS402 Assignment 1

The document is an assignment for the Theory of Automata course, detailing three questions related to regular expressions. It provides specific regular expressions for strings based on given conditions, such as starting and ending characters, the presence of substrings, and constraints on character repetition. Additionally, it requests the construction of a Deterministic Finite Automata (DFA) for one of the regular expressions provided.

Uploaded by

Sheikh wasi
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)
14 views2 pages

CS402 Assignment 1

The document is an assignment for the Theory of Automata course, detailing three questions related to regular expressions. It provides specific regular expressions for strings based on given conditions, such as starting and ending characters, the presence of substrings, and constraints on character repetition. Additionally, it requests the construction of a Deterministic Finite Automata (DFA) for one of the regular expressions provided.

Uploaded by

Sheikh wasi
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/ 2

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.

You might also like