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
Exam (elaborations)

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

Rating
-
Sold
-
Pages
8
Grade
A+
Uploaded on
23-04-2024
Written in
2023/2024

QUESTIONS WITH ANSWERS

Institution
Course

Content preview

COS3701 ASSIGNMENT 2
2024 (365071) - DUE 27
JUNE 2024




[Company address]

, 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

Written for

Institution
Course

Document information

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

Subjects

$5.49
Get access to the full document:

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

Get to know the seller
Seller avatar
JayBih
3.0
(1)

Get to know the seller

Seller avatar
JayBih Bournemouth University (London)
Follow You need to be logged in order to follow users or courses
Sold
5
Member since
2 year
Number of followers
5
Documents
113
Last sold
2 year ago

3.0

1 reviews

5
0
4
0
3
1
2
0
1
0

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

Working on your references?

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

Working on your references?

Frequently asked questions