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

Asg 2

This document provides instructions for Assignment 2 in COMP 335 for Fall 2021. It includes 6 questions in Part A that are graded, covering topics like regular expressions, finite state automata, regular grammars, closure properties of regular languages, and determining if a language is regular. Part B includes 4 additional practice questions that are not graded. The assignment is due by October 17th at 23:55 and should be submitted through Moodle.

Uploaded by

Payal Chaudhary
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)
112 views2 pages

Asg 2

This document provides instructions for Assignment 2 in COMP 335 for Fall 2021. It includes 6 questions in Part A that are graded, covering topics like regular expressions, finite state automata, regular grammars, closure properties of regular languages, and determining if a language is regular. Part B includes 4 additional practice questions that are not graded. The assignment is due by October 17th at 23:55 and should be submitted through Moodle.

Uploaded by

Payal Chaudhary
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

COMP 335: Assignment 2

Fall 2021
Submission through Moodle is due by Sunday October 17th at 23:55

Part A (Graded): Submit your solution to each of the following questions.


Total grade: 60 pts.

1. [5 pts] Give a regular expression for every string w over {0, 1} where the value of w,
when interpreted as a binary number, is at least 40.

2. [5 pts] Give a finite state automaton for the language denoted by the regular expression
r1∗ (r2 + r3 ), where r1 = a∅a, r2 = aa∗ (a + b∗ ), and r3 = (b + ab)∗ aa(b + ba)∗ .

3. [5 pts] Give a regular grammar for L(a∗ bb + ab∗ ba).

4. [10 pts] Consider the regular grammar G1 = (V1 , Σ, S1 , P1 ), where V1 = {S1 , A, B},
Σ = {a, b}, and P1 consists of the productions S1 → abA, A → baB, and B → aA | bb.
Also consider the grammar G2 = ({S2 , B}, Σ, S2 , P2 ), where the productions in P2 are:
S2 → aaB | λ
B → bB | ab
Give a left-linear grammar for the language L(G1 ) ∪ L(G2 ).

5. [15 pts] Suppose L is a regular language. Use the closure properties of regular languages
to show that each of the following languages is regular as well.

(a) {uv : u ∈ L and |v| = 2}.


(b) {uv : u ∈ L and v ∈ LR }.
(c) {u : u ∈ L and uR ∈ L}.

6. [20 pts] For each of the following languages, prove or disprove if it is regular.

(a) L1 = {a2i+5j : i, j ≥ 0}.


(b) L2 = {w : w ∈ {a, b}∗ and no two b’s in w have odd number of a’s in between}.
(c) L3 = {an : n = 3k, for k ≥ 0}.
(d) L4 = {an bm : n ≥ m}.

Part B (Not graded): Questions in this part are for your extra practice. Do
NOT submit your solutions to questions in this part.

1. Give a regular expression for each of the following languages over Σ = {a, b}:

(a) L1 = {w : w has no runs of as of length 2}.


(b) L2 = {an bm : n + m = 2k, k ≥ 0}.
2. Give a regular grammar for each of the languages in the previous question.

3. Find a regular expression for the complement of L2 in question 1(b) above.

4. Show that the language L = {an bm : n ̸= m} is not regular.

You might also like