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 3 Yearly Module 2022 (Unique Number: 830430)

Document preview thumbnail
Preview 2 out of 8 pages

Guaranteed A+. COS3701 Assignment 3 Yearly Module 2022

Content preview

UnisaAssignHelp




COS3701
Assignment 3
Unique Number:
830430

, UnisaAssignHelp
Question 1


Problem 6 (ii) on page 454:

Design a turing machine to accept the language anb2n

The TM in Figure 1 solves this problem.

From the START state an a is read and an A is printed on the tape. In state 1 the TM loops, moving the tape
head right, for all the as read until the first b is read.

If the first b is read a B is printed on the tape, the tape head moves right and we are at state 2. Another b
is read and the next B is printed on the tape, the tape head moves left, we arrive at state 3.

In state 3 we loop to the left reading first Bs and then as until we encounter an A which takes us to state 4.

In state 4 we read an a if all the as read have not yet been converted to As else we read a B. If we read an
a in state 4 the TM prints an A on the tape and the tape head moves right.

We are now in state 1 and the described cycle state 1 – state 2 – state 3 – state 4 is repeated until a B is
read in state 4.

If a B is read in state 4 we move to state 5. In state 5 we loop to the right through all the characters on
the remainder of the tape. If all these characters are Bs and we finally read ∆ then we move to the HALT
state.

Note, in short we compare the number of as to the number of bs by converting two bs to Bs for each a
converted to an A.

Document information

Uploaded on
July 5, 2022
File latest updated on
July 5, 2022
Number of pages
8
Written in
2021/2022
Type
Exam (elaborations)
Contains
Questions & answers
$6.39

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.
t0dd
4.0
(1)
Sold
38
Followers
33
Items
4
Last sold
3 year ago




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