Given the language , which of the following strings are in ?
View worked solution
Answer: C
To determine which strings belong to , we check if they can be partitioned into a sequence of substrings from .
- String 1:
Partition:
Since all components are in , this string is in . - String 2:
Partition:
Since all components are in , this string is in . - String 3:
This string ends with . Since is the only element in ending with , the string must end with the token , leaving the prefix ().
Any block starting with must begin with (the only element starting with ) followed by some number of tokens, which always produces an even number of 's (). However, the first block has 's (), which is odd and cannot be formed. Thus, this string is not in . - String 4:
Partition:
Since all components are in , this string is in .
Therefore, strings 1, 2, and 4 are in .
Free practice · Your answers on this page are not saved.
