Write a regular expression for the following language over the alphabet L = {x, y} such that it accepts all strings in which the letter y is never tripled. This means that no word contains the substring yyy.
Answers
Answered by
0
Answer:
1234566788900 synpllkk com
Answered by
0
(x*+y+yy)(x+xy+xyy)* is the regular expression that it accepts all strings in which the letter y is never tripled.
- (x*+y+yy)(x+xy+xyy)* supports a zero string or a string with n no.of letters in it.
- As we see the first part (x*+y+xyy) of the re, it either takes 0 or n no.of x, or one y, or two sequenced 'y's. If you opt x*, you can run it as xx...; it will be a simple y and so does xyy.
- The second part (x+xy+xyy)* yields either x or xy or xyy for 0 times, or the one chosen can be iterated for n times as in if one chooses x, they can repeat it as xxxxxxx...; if one chooses xy, they can iterate it as xyxyxy...; likewise if one opts xyy, they can run it as xyyxyyxyy.
- On concatenation, the strings will be xx or xxy or xxyy or yx or yxyy or yxyy or yxyyxyy and the list goes on, but you will never find a subset yyy in any word.
- So, we can say that (x*+y+yy)(x+xy+xyy)* is the best choice.
Quick fact :
In Regular expression,
'+' operator denotes repetition of operand 1 or more times and
'*' denotes the repetition of operand for zero or more times.
Learn more :
- What is Regular Expression?
https://brainly.in/question/9740036
- Describe the regular language generated by regular expression
https://brainly.in/question/2832520
Similar questions