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

CS402 Assignment 1 Solution Fall 2019

This document provides the solution to 3 questions regarding regular expressions over the alphabet {a, b}. It shows that certain regular expressions define the same language, develops a regular expression for a language where b is never tripled, and develops a regular expression for a language where either a or b is tripled but not both. Links are also provided for additional assignments and resources.

Uploaded by

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

CS402 Assignment 1 Solution Fall 2019

This document provides the solution to 3 questions regarding regular expressions over the alphabet {a, b}. It shows that certain regular expressions define the same language, develops a regular expression for a language where b is never tripled, and develops a regular expression for a language where either a or b is tripled but not both. Links are also provided for additional assignments and resources.

Uploaded by

sonia123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CS402 Assignment 1 Solution Fall 2019

Q1. Show that the following pairs of regular expressions define the same language over the

alphabet

L = {a, b}.

(i) (ab)*a and a(ba)*

(ii) (a* + b)* and (a + b)*

(iii) (a* + b*)* and (a + b)*

Solution:

• Since the strings generated by language (ab)*a and a(ba)* define the same strings ending
in a hence both RE define the same language.
• Both RE define the same language of all string containing any number of a’s and b’s
• Since (a* + b*)* and (a + b)* generate all string containing any number of a’s and b’s
hence both RE define the same language.
Q2. Develop a regular expression for the following language over the alphabet P = {a, b} such

that it accepts all strings in which the letter b is never tripled. This means that no word contains

the substring bbb.

Answer: since we need to define RE for a language that have strings like {Λ, abb,abba, aabbaa,…}

Hence the RE for this language would be (a * + bb)*

Q3. Develop a regular expression for the following language over the alphabet P = {a, b} such

that it accepts all strings all words in which a is tripled or b is tripled, but not both. This means

each word contains the substring aaa or the substring bbb but not both.

Answer: since we need to develop a RE for a language that have strings like {aaab, bbbaa, aaabb}

Hence the required RE for this language would be (aaa* + b) + (bbb+ + a)


+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ http://bit.ly/ningsearch (Click Here to Search Looking For something at ning Site.

+ http://bit.ly/fbvuning (Join also Our Facebook Group For Study Help)

You might also like