• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 10 pages
Other

COS2601 Assignment 2 Solutions 2026

Document preview thumbnail
Preview 2 out of 10 pages

COS2601 Assignment 2 Solutions 2026 UNISA 0-7-9-3-2-2-6-4-2-7

Content preview

COS2601 Assignment 2 Solutions 2026
UNISA
Theory of Computability — Full Worked Solutions

, QUESTION 1 [10]
(a) S = {ba, bb, baa, bab, aba}. Determine whether each string is a word in S*.
(i) baabababb
A string is a word in S* if it can be written as a concatenation of one or more elements of S. We
attempt to factorise the string using only elements of S:
baabababb = baa · ba · ba · bb
Check each factor is an element of S: baa ∈ S ✓, ba ∈ S ✓, ba ∈ S ✓, bb ∈ S ✓.
Verifying the concatenation reproduces the original string:
baa + ba + ba + bb = baabababb ✓
Conclusion: baabababb IS a word in S*, since it equals baa·ba·ba·bb, a concatenation of elements
of S.
(ii) babbaab
We attempt every possible factorisation of babbaab using elements of S = {ba, bb, baa, bab, aba}.
The string begins 'ba...', so the first factor can only be ba, baa or bab (the only elements of S starting
with 'ba'):
• First factor bab (positions 1–3) → remainder = baab. This remainder must itself factor into S*. Its
own first factor can only be ba or baa (bab does not match, since position 6 is 'a' not 'b'). ba (pos 4–5)
leaves remainder 'ab', which is not in S. baa (pos 4–6) leaves remainder 'b', which is not in S (single
letters are never elements of S). Dead end.
• First factor baa (positions 1–3) is impossible, since position 3 of the string is 'b', not 'a' — baa
requires the 3rd symbol to be 'a'.
• First factor ba (positions 1–2) → remainder = bbaab. Its first factor can only be bb (the only element
of S beginning 'bb'; ba/baa/bab are impossible since position 4 is 'b' not 'a'). bb (pos 3–4) leaves
remainder 'aab'. The only element of S starting with 'a' is aba, but aab ≠ aba (3rd symbol differs).
Dead end.
Every possible first factor leads to a dead end, so no factorisation of babbaab into elements of S
exists.
Conclusion: babbaab is NOT a word in S*.
(b) Example of two sets S, T on {a,b} such that S ⊄ T and S*∩T* = (S∩T)*.
Let S = {a, aa} and T = {a}.
Check S ⊄ T: aa ∈ S but aa ∉ T, so S is not a subset of T. ✓
Compute each side:
• S∩T = {a}, so (S∩T)* = a*
• S* : since S = {a, aa}, every string of a's can be built from a and aa, so S* = a*
• T* = a* (since T = {a})
• S*∩T* = a* ∩ a* = a*
Conclusion: S*∩T* = a* = (S∩T)*, while S ⊄ T, as required.
(c) S = {a, bb, bab}. List all words in S* of exactly 5 letters.
Every word of S* is a concatenation of copies of a (length 1), bb (length 2) and bab (length 3). We
need all combinations of these lengths that sum to 5, and for each combination, every ordering of the
pieces:
Case 1+1+1+1+1 (five a's):
aaaaa

Table of contents

  1. 01 COS2601 Assignment 2 Solutions 2026 — Theory of Computability — Full Worked Solutions 1
    1. QUESTION 1 2
    2. QUESTION 2 3
    3. QUESTION 3 3
    4. QUESTION 4 4
    5. QUESTION 5 5
    6. QUESTION 6 6
    7. QUESTION 7 7
    8. QUESTION 8 8
    9. QUESTION 9 8
    10. QUESTION 10 9

Document information

Uploaded on
July 10, 2026
Number of pages
10
Written in
2025/2026
Type
Other
Person
Unknown
$4.68

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.
TsireT
4.8
(9)
Sold
66
Followers
1
Items
52
Last sold
1 month ago



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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions