0% found this document useful (0 votes)
20 views4 pages

Theory of Automata

Uploaded by

fmdatazone
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)
20 views4 pages

Theory of Automata

Uploaded by

fmdatazone
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/ 4

Theory of Automata-

CS402

Assignment #01

Name: Ayesha Akbar

VU Id: bc240203013

Submitted To: Dr.


Shahid.S.Siddiqui

Semester: Fall -2024


Question#1:

a. Write the regular expression for language consists of all strings that ends and
have exact one b and can have any number of a’s (excluding none) before it,
over the set of alphabets Σ={a,b}.

Solution:

Regular Expression for the language:

The language consist of all strings that:

o End with exactly one b.


o Can have any number of a’s(excluding none).
o It cannot have any b before the final b.

Thus the regular expression can be written as:

a+b.

b. Draw the Finite Automaton for above language?

Solution:
Question#2:

Consider the language L of strings, defined over ∑= {a, b}, Write the answers of
the following:

a) If the regular expression is (𝑎𝑏)*, how many different strings of length 4 are
in this language?

Solution:

This regular expression represent zero or more repetitions of the string “ab”.

As ab contain 2 characters. So, to create a string of length 4, we need two


repetitions of “ab”. String is “abab”.

Then, the number of string of length 4 is 1(“abab”).

b) If the regular expression is (𝑎∣𝑏)2, how many strings of length 2 can it


generate?

Solution:

This regular expression allow two characters where each character can
independently be either ‘a’ or ‘b’. Here | operator represent a choice between ‘a’ or
‘b’.

Total number of strings of length 2 is 2*2=4 because each characters has 2 choices
(‘a’ or ‘b’).

Then, the generated strings are:


aa,ab,ba,bb

The number of generated strings of length 2 is 4.

c) If the regular expression is (𝑎𝑏∣𝑏𝑎)2, how many distinct strings of length 4


can be generated?

Solution:

The regular expression allow two repetitions of either “ab” or “ba”.


For each of the position in the string, there are 2 possible options: “ab” or “ba”.

The distinct string of length are “abab”, “abba”, “baab”, “baba”.

The number of generated distinct strings of length 4 is 4.

You might also like