100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS2601 ASSIGNMENT 2,SEMESTER 1,YEAR 2021 $4.50   Add to cart

Other

COS2601 ASSIGNMENT 2,SEMESTER 1,YEAR 2021

2 reviews
 48 views  5 purchases
  • Course
  • Institution

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

Preview 2 out of 6  pages

  • June 26, 2021
  • 6
  • 2020/2021
  • Other
  • Unknown

2  reviews

review-writer-avatar

By: ronewakhandekhande56 • 3 year ago

review-writer-avatar

By: jubilatemukwevho • 3 year ago

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

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 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 these notes from?

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

Will I be stuck with a subscription?

No, you only buy these notes for $4.50. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

64438 documents were sold in the last 30 days

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

Start selling
$4.50  5x  sold
  • (2)
  Add to cart