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

COS3701 Assignment 2 (DETAILED ANSWERS) 2025 - DISTINCTION GUARANTEED

Rating
-
Sold
6
Pages
10
Grade
A+
Uploaded on
01-07-2025
Written in
2024/2025

COS3701 Assignment 2 (DETAILED ANSWERS) 2025 - DISTINCTION GUARANTEED - DISTINCTION GUARANTEED - DISTINCTION GUARANTEED Answers, guidelines, workings and references ,.... Question 1 10 Find CFGs for all words that do not have the substring aba over the alphabet Σ = {a b}. Question 2 10 Convert the grammar below to CNF (Hint: Consult the online study material) S aX | Yb X ZXYZ | a Y b | bY | ᴧ Z a | ᴧ Question 3 15 Build a DPDA that accepts the language L = {(ab)n(ba)n-2| n > 2}. Question 4 15 Prove that the language L = {an+1b2n (aa)n b | n > 0} is non-context free. Use the pumping lemma with length.

Show more Read less









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

Document information

Uploaded on
July 1, 2025
Number of pages
10
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

COS3701
Assignment 2 2025
Unique #:

Due Date: 2025

Detailed solutions, explanations, workings
and references.

+27 81 278 3372

, QUESTION 1

CFG Rules

S → aA | bS | ε

A → aA | bAB | ε

AB → aDead | bS



CFG for all strings not containing "aba":

1. S → aA | bS | ε

2. A → aA | bAB | ε

3. AB → bS

Explanation:

 S: Starting point. From here, you can generate:
o aA if an "a" is read
o bS if a "b" is read
o ε (empty string is allowed)
 A: Seen an "a", must be careful not to follow with "ba"
 AB: Seen "ab", avoid completing with "a" (which would make "aba")
We avoid generating "aba" by not allowing AB → a... (that rule is excluded).



Examples of valid strings:

"", "a", "b", "aa", "ab", "ba", "bb", "aab", "abb", "bab"



Examples of strings NOT generated:

"aba", "aaba", "baba", "ababa"

QUESTION 2




Varsity Cube 2025 +27 81 278 3372

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.
VarsityC AAA School of Advertising
View profile
Follow You need to be logged in order to follow users or courses
Sold
28681
Member since
8 year
Number of followers
13258
Documents
3117
Last sold
1 week ago

4,1

2819 reviews

5
1490
4
581
3
392
2
117
1
239

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 exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT 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