100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

COS3701 Assignment 3 (COMPLETE ANSWERS) 2025 - DUE 2025

Rating
-
Sold
-
Pages
7
Grade
A+
Uploaded on
19-08-2025
Written in
2025/2026

COS3701 Assignment 3 (COMPLETE ANSWERS) 2025 - DUE 2025

Institution
Course









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Course

Document information

Uploaded on
August 19, 2025
Number of pages
7
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

COS3701
Assignment
3

USER
[Email address]

, COS3701 Assignment 3 (COMPLETE ANSWERS) 2025 - DUE 2025;. Question 1 [10] Given
that L1 = (aa)* and L2 = (a + b)*ab(a + b)*. Find grammars for L1 and L2. Then use Theorem
37 to find L1L2. Question 3 [10] Using theorem 42 algorithm to determine whether the
following grammar generate any words. S AB A BC C DA B CD D a A b Look at the
reformulated version of Theorem 42 in your online study units Question 4 [15] Build a Turing
Machine (TM) that • accepts all words in {an bn am | n ≥ 0; m > n} • loops forever on all words
starting with b, and • rejects all other words. Assume that the alphabet is Σ = {a, b} Question 5
[15] Build a 2PDA that accepts the language {a2nbnanb2n | n > 0}.




Question 1 [10 Marks]
Given:

 L₁ = (aa)*
 L₂ = (a + b)ab(a + b)



(a) Grammar for L₁ = (aa)*

L₁ consists of strings made up of even numbers of a's, i.e. 0 or more repetitions of “aa”.

CFG G₁ for L₁:

S₁ → ε
S₁ → aa S₁



(b) Grammar for L₂ = (a + b)ab(a + b)

This language includes all strings over {a, b} that contain the substring ab.

CFG G₂ for L₂:

S₂ → A a b B
A → ε | a A | b A
B → ε | a B | b B



(c) Grammar for L₁L₂ using Theorem 37

Theorem 37:
Let G₁ and G₂ be CFGs for L₁ and L₂. A grammar G for L₁L₂ is given by:

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
quizwhiztutors Teachme2-tutor
Follow You need to be logged in order to follow users or courses
Sold
42
Member since
3 months
Number of followers
0
Documents
97
Last sold
1 month ago

3.7

6 reviews

5
2
4
1
3
2
2
1
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions