Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4,6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 8 pages
Exam (elaborations)

COS3701 Assignment 2 2024 (365071) - DUE 27 June 2024

Document preview thumbnail
Preview 2 out of 8 pages

QUESTIONS AND ANSWERS

Content preview

COS3701
ASSIGNMENT 2 2024
(365071) - DUE 27
JUNE 2024
QUESTIONS WITH COMPLETE ANSWERS




[School]
[Course title]

, COS3701 Assignment 2 2024 (365071) - DUE 27 June 2024

Question 1 [15]
Build a DPDA to show that the language L = {(ba)na(ab)n-2 | n > 2} is
deterministic context free.
Deterministic Pushdown Automaton (DPDA) for L = {(ba)na(ab)n-2 | n > 2}
States:
• q0: Start state
• q1: Reading the first part (n repetitions of "ba")
• q2: Reading the middle "aaa"
• q3: Reading the second part (n-2 repetitions of "ba")
• q4: Accepting state
Stack Alphabet:
• X: Symbol used for bookkeeping
Input Alphabet:
• Σ = {a, b}
Transition Function (δ):
δ is a function that maps (state, input symbol, top stack symbol) to a next state
and a stack symbol to push (or ε for no push). Here's the table representation:
| δ(q, σ, z) | |---|---| | δ(q0, a, -) | (q1, X) | // Start reading "ba" and push X |
δ(q0, b, -) | - | // Reject if input doesn't start with "a" (deterministic) | δ(q1, b,
X) | (q1, X) | // Read "b" in "ba" and keep X | δ(q1, a, X) | (q2, ε) | // Read "a"
in "ba", consume X, and move to middle "aaa" | δ(q2, a, -) | (q2, a) | // Read
first "a" in "aaa" and push "a" | δ(q2, a, a) | (q2, aa) | // Read second "a" in
"aaa" and push another "a" | δ(q2, a, aa) | (q3, X) | // Read third "a" in

For exam pack with questions and answers, quality notes, assignments and exam
help:
email:
WhatsApp: +254792947610

Document information

Uploaded on
April 23, 2024
Number of pages
8
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers
$3.00

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

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.
msmartie11
3.9
(30)
Sold
246
Followers
224
Items
1232
Last sold
10 months ago



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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions