share ideas
SOLVED CS402 Assignment 1 Solution and Discussion


Q1. Show that the following pairs of regular expressions define the same language over the alphabet
L = {p, q}.
(i) (pq)p and p(qp)
(ii) (p* + q)* and (p + q)*
(iii) (p* + q*)* and (p + q)*
[15 marks = 5*3]Solution:
(i) (pq)p and p(qp) represents same language.
Both will never generate pp’s and both are starting and ending with p(ii) (p* +q)* (p+q)*
(p*)+ q p* + q*
p* + q* p* + q*
Both are all strings possible in L = {p,q}(iii) (p* +q*)* (p+q)*
(p*)* + (q*)*
p* + q*
(p + q)* Language with all stringsQ2. Write a regular expression for the following language over the alphabet L = {x, y} such that it accepts all strings in which the letter y is never tripled. This means that no word contains the substring yyy. [5 marks]
Solution:
The required R.E will be
(˄ + y + yy) (x + xy + xyy)* 
Q1. Show that the following pairs of regular expressions define the same language over the alphabet
L = {p, q}.
(i) (pq)p and p(qp)
(ii) (p* + q)* and (p + q)*
(iii) (p* + q*)* and (p + q)*
[15 marks = 5*3]Solution:
(i) (pq)p and p(qp) represents same language.
Both will never generate pp’s and both are starting and ending with p(ii) (p* +q)* (p+q)*
(p*)+ q p* + q*
p* + q* p* + q*
Both are all strings possible in L = {p,q}(iii) (p* +q*)* (p+q)*
(p*)* + (q*)*
p* + q*
(p + q)* Language with all stringsQ2. Write a regular expression for the following language over the alphabet L = {x, y} such that it accepts all strings in which the letter y is never tripled. This means that no word contains the substring yyy. [5 marks]
Solution:
The required R.E will be
(˄ + y + yy) (x + xy + xyy)* 
Assignment No. 01Semester: Spring 2020Theory of Automata – CS402
Total Marks: 20
Due Date: 060120
Objectives:
Objective of this assignment is to assess the understanding of students about the concept of languages, regular expressions and finite automata.Instructions:
Please read the following instructions carefully before submitting assignment:
You should consult the recommended books, PowerPoint slides and audio lectures to clarify your concepts.
You are supposed to submit your assignment in .doc format. Any other formats like scan images, PDF, zip, rar and bmp etc will not be accepted.
It should be clear that your assignment will not get any credit if:
The assignment is submitted after due date.
The assignment is copied from Internet or from any other student.
The submitted assignment does not open or file is corrupt.Note: No assignment will be accepted after the due date through email in any case (load shedding, server down, internet malfunctioning etc.).
It is recommended to upload solution file at least two days before its closing date.For any query about the assignment, contact at [email protected]
Question: Marks = 20
Q1. Show that the following pairs of regular expressions define the same language over the alphabetL = {p, q}.
(i) (pq)p and p(qp)
(ii) (p* + q)* and (p + q)*
(iii) (p* + q*)* and (p + q)*
[15 marks = 5*3]
Q2. Write a regular expression for the following language over the alphabet L = {x, y} such that it accepts all strings in which the letter y is never tripled. This means that no word contains the substring yyy. [5 marks]