Which of the CFL can generate exactly the following language {w: w=w^R}, the alphabet is {0, 1}. (there may be more than one correct answer)
A. S -> 0S0 | 1S1 | 0 | 1
B. S -> T
T-> 0T0 | 1T1 | 0 | 1 | ɛ
C. S -> 0S0 | 1S1 | 0 | 1 | ɛ
D. S -> 0T0 | 1T1 | ɛ
T-> 0T0 | 1T1 | 0 | 1 | ɛ
.Here all the four CFL can
genrate language
over alphabet {0,1}
Let us have a look at them one by one
A) S -> 0S0 | 1S1 | 0 | 1
lets generate few string using grammar
strings of length one
0,1
there is no string of length two
strings of length three
000,111,010,101
Now we can infer that language will be ={0,1,000,111,010,101............}
here we can observe that all the strings that will be generated
by this CFL will be of odd length and all satisfy
.
B)
S -> T
T-> 0T0 | 1T1 | 0 | 1 | ɛ
let's generate few string using grammar
strings of length one
0,1
strings of length two
00,11
strings of length three
000,111,010,101
strings of length of four
0000,1111,0110,1001
Now we can infer that language will be ={
,0,1,00,11,000,111,010,101,0000,1111,0110,1001............}
here we can observe that all the strings of length even and odd
that can be generated by this CFL satisfy
.
C) This case is same as B , logically there is no difference between B option and C option,B can also be written as C and will produce same result.
D) S -> 0T0 | 1T1 | ɛ
T-> 0T0 | 1T1 | 0 | 1 |
let's generate few string using grammar
there is no string of length one generated by this CFL
strings of length two
00,11
strings of length three
000,111,010,101
strings of length of four
0000,1111,0110,1001
Now we can infer that language will be ={
,00,11,000,111,010,101,0000,1111,0110,1001............}
here also we can observe that all the strings of length even and
odd that can be generated by this CFL satisfy
.
note :- feel free to ask doubts in comments :)
Which of the CFL can generate exactly the following language {w: w=w^R}, the alphabet is {0,...
Give a DFA for the following language over the alphabet Σ = {0, 1}: L={ w | w starts with 0 and has odd length, or starts with 1 and has even length }. E.g., strings 0010100, 111010 are in L, while 0100 and 11110 are not in L.
1(a)Draw the state diagram for a DFA for accepting the following language over alphabet {0,1}: {w | the length of w is at least 2 and has the same symbol in its 2nd and last positions} (b)Draw the state diagram for an NFA for accepting the following language over alphabet {0,1} (Use as few states as possible): {w | w is of the form 1*(01 ∪ 10*)*} (c)If A is a language with alphabet Σ, the complement of A is...
Construct a regular expression that recognizes the following language of strings over the alphabet {0 1}: The language consisting of the set of all bit strings that start with 00 or end with 101 (or both). Syntax The union is expressed as R|R, star as R*, plus as R+, concatenation as RR. Epsilon is not supported but you can write R? for the regex (R|epsilon).
It wants a diagram
Construct a TM M4 which accepts the language [w2w | w in (0,1)). This means, any input that comprises two copies of a binary string w separated by a single 2 symbol should be accepted. Any other input should be rejected. The input alphabet is (0,1,2). The tape alphabet contains 0, 1,2,_and you may use additional symbols 3, 4, , 9 if you wish (M4 can be constructed comfortably with just one additional symbol 3). The...
Part B - Automata Construction Draw a DFA which accepts the following language over the alphabet of {0,1}: the set of all strings such that the number of 0s is divisible by 2 and the number of 1s is divisible by 5. Your DFA must handle all intput strings in {0,1}*. Here is a methodical way to do this: Figure out all the final states and label each with the shortest string it accepts, work backwards from these states to...
Formal Languages and Automata Theory
Q2. Give context-free grammars that generate the following language: { w є {0, 1} | w contains at least three 1's)
Aliases can be created by which of the following language constructs? (May contain more than one possible answer) A.) The union types of C and C++ B.) Assignment statements C.) Pointer assignments D.) Whole array operators
1. A signal (t) with Fourier transform X(ju) undergoes impulse-train sampling to generate where T = 4 x 10-4. For each of the following sets of constraints on r(t) and/or X(ju), does the sampling theorem guarantee that r(t) can be recovered exactly from p(t)? a. X(ju) = 0 for l니 > 1000-r b, X(ju) = 0 for lal > 5000π c. R(X(ju))-0 for lwl > 1000-r d, x(t) real and X(jw)-0 for w > 1000π e. x(t) real and X(jw)-0...
(g) If there is an NFA with s states which accepts a language L, then we can construct a DFA which accepts the same language and has: (circle the smallest correct answer a) s states b) 2s states d) 2 states (h) If there is a DFA which accepts a language A with s states and another whiclh accepts language B with t states, then we can construct a DFA which accepts An B which has (circle the smallest correct...
Let W be a subspace of the vector space R" . Identify which of the following statements are true. A. We have that W+ is a subspace of R" B. We have that (w+)' = W C. We have that Ww= {0} D. We have that dim W + dim W! =n E. All of the above. Choose the correct answer below. A. B. C. D. E.