Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Let the alphabet sigma ={0, 1}. Write a regular expression for each of the follo

ID: 3811405 • Letter: L

Question

Let the alphabet sigma ={0, 1}. Write a regular expression for each of the following. In this question, you may not use the extended notation (only union, concatenation, and Kleene star). i. Bit strings that have an even number of 0's. ii. All words in which '1' appears tripled (and only tripled, meaning all 1's must appear in groups of three). The empty string is also accepted. iii. All bit strings that do not have substring '01'. iv. All bit strings that contain exactly two 0's or exactly three 0's. Write down all strings that are matched by the following regular expressions (If there are infinitely many, clearly a pattern - i.e. a, aa, aaa, ....): (very) + (chubby) ? (short | ugly) (wo)? man Write a formal grammar for the alphabet sigma ={a, b, c} that accepts the language of strings that is read the same forward and backwards (i.e. 'abcba' is in the language but 'bcab' is not)

Explanation / Answer

i.The set of strings with even no of 0s include 00, 001, 0011, 1001, 1010, …. The regular expression can be written as

1*(01*01*)*

ii.triple 1 only so strings will be 0111,1110,00111,11100,01110, that means any number of 0s but (111) together,the regular expression can be 0*((111)*0*)*

iii. string with no 01 combination so it should in pattern 1followed by 0.so Regular expression can be 1*0*.

iv.exactly 2 zeros or 3 zeros means (00) or (000) only should be there and any no of 1's.so regular expression can be (1*(00)1*+1*(000)1*)

C) grammer for string that is read the same from front or back :

S -> a

S -> b

S -> c

S -> aSa

S -> bSb

S -> cSc