100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS2601 Assignment 2 Year 2023 R100,00   Add to cart

Other

COS2601 Assignment 2 Year 2023

1 review
 118 views  7 purchases

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.

Preview 1 out of 7  pages

  • May 23, 2023
  • 7
  • 2022/2023
  • Other
  • Unknown
  • cos2601
All documents for this subject (43)

1  review

review-writer-avatar

By: willemcierenberg • 1 year ago

reply-writer-avatar

By: Learn2Progress • 1 year ago

Thank You. All the best, Learn2Progress

avatar-seller
Learn2Progress
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.

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying this summary from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Learn2Progress. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy this summary for R100,00. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73216 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 14 years now

Start selling
R100,00  7x  sold
  • (1)
  Buy now