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 [Unique No:830417] 2022

Rating
5.0
(1)
Sold
7
Pages
14
Grade
A+
Uploaded on
05-07-2022
Written in
2021/2022

COS3701 Assignment 2 Solutions A+ Guaranteed. Contact us if you have any queries. Note do not submit the file as it is, to avoid plagiarism use this document as a guide for your own assignment .

Institution
Course









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

Written for

Institution
Course

Document information

Uploaded on
July 5, 2022
Number of pages
14
Written in
2021/2022
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

For Assistance with other modules
Call or Whatsapp +27682021794
www.myassignments.co.za




COS3701
Assignment 02
2022

Due date
7 July 2022,
11:00 PM

UNIQUE NUMBER:
830417

+27682021794 www.myassignments.co.za [AUTHOR NAME]

, QUESTION 1
Build a DPDA to show that the language



is deterministic context free.

The smallest word in this language is when n= 3. This word is abababaaaba. All words in this
language start with three or more abs and end with one or more bas where there are always
two more abs than bas.

The trick to showing that this language is context free is to use the PDA to "match" the
occurrences of ab to the occurrences of ba which appear later in the string. We should also
take care of the fact that there have to be two more abs than bas but there has to be at least
one ba (and three abs).The aaa string in the middle is a separator and does not affect the
decision of whether or not the language is context free.

Our PDA can thus be outlined as

1. Read two instances of ab (but do nothing to the stack). These are the extra abs that we can
simply get rid of because we know there should be exactly two of them.

2. Read in one instance of ab (this matches with the one required ba).

3. Read in additional instances of ab and for each such instance push an X onto the stack.
Here we are essentially counting how many abs we have.

4. Read in aaa (but do nothing to the stack).

5. Read in the one required ba.

6. Read in instances of ba and for each instance pop an X off the stack. Here each ba is ticked
off against an ab that was read at the beginning of the string.

7. When all of the bas have been read then check that the input string and the stack are both
empty. We can now build a PDA to do this. The PDA is shown in diagram below.




2

Reviews from verified buyers

Showing all reviews
3 year ago

5.0

1 reviews

5
1
4
0
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

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.
MyAssignments My Assignments
Follow You need to be logged in order to follow users or courses
Sold
171
Member since
4 year
Number of followers
144
Documents
38
Last sold
4 months ago
My Assignments

3.8

21 reviews

5
11
4
3
3
2
2
1
1
4

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