Why Choose Us?
0% AI Guarantee
Human-written only.
24/7 Support
Anytime, anywhere.
Plagiarism Free
100% Original.
Expert Tutors
Masters & PhDs.
100% Confidential
Your privacy matters.
On-Time Delivery
Never miss a deadline.
COMP 330 - Fall 2020 - Assignment 2 Due: 11:59pm Oct 8 th
COMP 330 - Fall 2020 - Assignment 2
Due: 11:59pm Oct 8 th.
General rules: In solving these questions you may consult books or other available notes, but you need to provide citations in that case. You can discuss high level ideas with each other, but each student must find and write her/his own solution. Copying solutions from any source, com-
pletely or partially, allowing others to copy your work, will not be tolerated, and will be reported to the disciplinary office.
You should upload the pdf file (either typed, or a clear and readable scan) of your solution to mycourses.
1. (35 points) For each one of the following languages give a proof that it is or is not regular.
( a )
{0m1n|m ≥ 5 and n ≥ 0}.
( b )
{0m1n|m ≥ n2}.
- The set of strings in {0,1}∗ which are not of the form ww for some w ∈{0,1}∗.
- Over the alphabet Σ = {0,1}:
- = {x|x contains the same number of 01’s and 10’s as substrings}
- Over the alphabet Σ = {0,1,2}:
- = {x|x contains the same number of 01’s and 10’s as substrings}
- The first two Fibonacci numbers are 0 and 1, and each subsequent number is the sum of the previous two: 0,1,1,2,3,5,8,13,.... Now the language in question is
{0n|n is a Fibonacci number}.
1
- The set of strings in {0,1}∗ which are not palindromes:
{w ∈{0,1}∗ | w 6= wR}.
2. (a) (3 points) Find a left-most derivation for aaabbabbba in the following context-free grammar:
|
S |
→ |
aB | bA |
|
A |
→ |
a | aS | bAA |
|
B |
→ |
b | bS | aBB |
(b) (2 points) Draw the corresponding parse-tree of your left-most derivation. 3. (10 points) Show that the language of the grammar S → 0S1 | 1S0 | SS | ε is
{w ∈{0,1}∗ | w contains the same number of zeros and ones}.
- (20 Points) Construct a context free grammar for the set of all words w over the alphabet {0,1} such that each prefix[1] of w has at least as many 0’s as 1’s. You have to prove that (i) every such word can be generated with your grammar, and (ii) every word generated by your grammar has the desired property.
- (20 points) For each one of the following languages construct a context-free grammar that generates that language:
( a )
{0,1}∗.
( b )
{0m1n | m ≥ n and m − n is even}.
-
- The complement of {0n1n | n ≥ 0} over the alphabet {0,1}.
- The set of strings in {0,1}∗ which are not palindromes:
{w ∈{0,1}∗ | w 6= wR}.
6. (10 Points) Use the equivalence of context-free grammars and push-down automata to show that if A and B are regular languages, then {xy|x ∈ A,y ∈ B,|x| = |y|} is context-free.
2
[1] A prefix is a substring that starts from the beginning of the word.
Expert Solution
Please use this google drive link to download the answer file.
https://drive.google.com/file/d/1uSXLap7mYO23Cez1QD9BXx4zluZUCjQ4/view?usp=sharing
Note: If you have any trouble in viewing/downloading the answer from the given link, please use this below guide to understand the whole process.
https://helpinhomework.org/blog/how-to-obtain-answer-through-google-drive-link
Archived Solution
You have full access to this solution. To save a copy with all formatting and attachments, use the button below.
For ready-to-submit work, please order a fresh solution below.





