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

COS2601 Assignment 2 Year 2023

Rating
5,0
(1)
Sold
7
Pages
7
Uploaded on
23-05-2023
Written in
2022/2023

Complete Solutions to COS2601 Assignment 2 for the year 2023. Please note this is programming-language fluid and may not be 100% as per your chosen programming language.









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

Document information

Uploaded on
May 23, 2023
Number of pages
7
Written in
2022/2023
Type
Other
Person
Unknown

Subjects

Content preview

Question 1a
Universal Set:

The appropriate universal set for this language is the set of all possible strings over the alphabet Σ =
{a, b}. Let's denote this set as U.


Question 1b
The generators of ODDnotAB can be defined as follows:

The empty string ε is a generator of ODDnotAB.
For any string x in ODDnotAB, the strings xa and xb are also generators of ODDnotAB.


Question 1c
Function on the Universal Set:

We need to define a function on the universal set that determines whether a given string belongs to
ODDnotAB or not. Let's denote this function as isInODDnotAB(x), where x is a string from the
universal set U. The function isInODDnotAB(x) returns true if x belongs to ODDnotAB, and false
otherwise.


Question 1d
Recursive Definition of ODDnotAB:

Using the concepts described above, we can write the recursive definition for the language
ODDnotAB as follows:

1. Base Cases:
a) The empty string ε is in ODDnotAB.
isInODDnotAB(ε) = true
b) Strings of length 1:
For any single character string x, isInODDnotAB(x) = true.

2. Recursive Cases:
a) If x is a string in ODDnotAB, then the strings xa and xb are also in ODDnotAB.
isInODDnotAB(xa) = isInODDnotAB(x)
isInODDnotAB(xb) = isInODDnotAB(x)

b) If x is a string in ODDnotAB, then the strings xaa and xab are also in ODDnotAB.
isInODDnotAB(xaa) = isInODDnotAB(x)
isInODDnotAB(xab) = isInODDnotAB(x)

c) If x is a string in ODDnotAB, then the strings xba and xbb are also in ODDnotAB.
isInODDnotAB(xba) = isInODDnotAB(x)
isInODDnotAB(xbb) = isInODDnotAB(x)

By using these base cases and recursive cases, we can determine whether a given string belongs to the
language ODDnotAB or not.

Reviews from verified buyers

Showing all reviews
2 year ago

2 year ago

Thank You. All the best, Learn2Progress

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.
Learn2Progress Learn2Progress
View profile
Follow You need to be logged in order to follow users or courses
Sold
75
Member since
3 year
Number of followers
63
Documents
15
Last sold
1 year ago

4,6

5 reviews

5
4
4
0
3
1
2
0
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 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

Frequently asked questions