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

COS2601 ASSIGNMENT 2,SEMESTER 1,YEAR 2021

Rating
4.0
(2)
Sold
5
Pages
6
Uploaded on
26-06-2021
Written in
2020/2021

THIS DOCUMENT CONTAINS DETAILED STEP BY STEP SOLUTIONS FOR COS2601, ASSIGNMENT 2, SEMESTER 1, 2021

Institution
Course









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

Written for

Institution
Course

Document information

Uploaded on
June 26, 2021
Number of pages
6
Written in
2020/2021
Type
Other
Person
Unknown

Subjects

Content preview

COS2601
ASSIGNMENT 2
SEMESTER 1
2021

, Question 1
A recursive definition for the language EVENnotBAB over the alphabet = {a b} must be compiled where
EVENnotBAB consists of all words of even length and not containing the substring bab.

Give (i) an appropriate universal set,
(ii) the generator(s) of EVENnotBAB, and
(iii) an appropriate function on the universal set, and then
(iv) use these concepts to write down a recursive definition of the language EVENnotBAB.

Answer
(i) The set Σ = {a b}* will be suitable because it contains, along with other words, all the words that
are in the language EVENnotBAB.

(ii) The generators should be of even length and should not contain the substring bab. One possible
choice is . Another possible choice is , aa, ab, ba and bb. Remember that zero is an even
number.

(iii) The function CONCAT, as defined in the notes in the learning units, will be suitable.

(iv) We give two possible recursive definitions. Note that all words in EVENnotBAB should have an
even number of letters. The generators all have an even number of letters; therefore, to keep the
length of new words even, we concatenate two letters at a time.

EVENnotBAB is the smallest subset of {a b}* such that
EVENnotBAB and
if w EVENnotBAB, then also
CONCAT(w, aa) EVENnotBAB,
if w EVENnotBAB and w does not end on a ba, then
CONCAT(w, bb), CONCAT(w, ba) EVENnotBAB and
if w EVENnotBAB and w does not end on a b, then
CONCAT(w, ab) EVENnotBAB
or
Rule 1: , aa, ab, ba, bb EVENnotBAB.
Rule 2: If w EVENnotBAB, then also
CONCAT(aa, w) EVENnotBAB,
if w EVENnotBAB and w does not start with an ab, then
CONCAT(bb, w), CONCAT(ab, w) EVENnotBAB,
2

Reviews from verified buyers

Showing all 2 reviews
4 year ago

4 year ago

4.0

2 reviews

5
0
4
2
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.
reagantarbots-hepomarlpayne University of South Africa (Unisa)
Follow You need to be logged in order to follow users or courses
Sold
86
Member since
5 year
Number of followers
73
Documents
1
Last sold
1 year ago

3.5

10 reviews

5
1
4
4
3
4
2
1
1
0

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