How many strings can this grammar generate?
X -> YY
Y -> ZZ
ZZ -> 0 | 1 | ε
Is there a shortcut to solving this rather than making all of the
possible combinations?
All the strings are ε 0 1 00 01 10 11 000 001 010 011 100 101 110 111 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 so, total number of strings = 31 Answer: 31
How many strings can this grammar generate? X -> YY Y -> ZZ ZZ -> 0...
Construct context-free grammars that generate the given set of
strings. If the grammar has more than one variable, we will ask to
write a sentence describing what sets of strings expect each
variable in the grammar to generate. For example, if the grammar
was:
I could say "C generates binary strings of length one, E
generates (non-empty) even length binary strings, and O generates
odd length binary strings." It is also fine to use a regular
expression, rather than English,...
Construct context-free grammars that generate the given set of
strings. If the grammar has more than one variable, we will ask to
write a sentence describing what sets of strings expect each
variable in the grammar to generate. For example, if the grammar
was:
I could say "C generates binary strings of length one, E
generates (non-empty) even length binary strings, and O generates
odd length binary strings." It is also fine to use a regular
expression, rather than English,...
For each of the following, construct context-free grammars that generate the given set of strings. If your grammar has more than one variable, we will ask you to write a sentence describing what sets of strings you expect each variable in your grammar to generate. For example, if your grammar were: S → EO E → EE CC 0+ EC C+01 We would expect you to say “E generates (non-empty) even length binary strings; O generates odd length binary strings;...
How many distinct programs can the following grammar generate? S rightarrow a Z f xrightarrow b c | c b Y rightarrow de|cd Z rightarrow XY| YX a) 1 b) 4 c) 8 d) 24 e) An infinite number A5) Suppose you have a working compiler, properly modularized, that generates code for the MIPS instruction set. Which components would you have to change to adapt this compiler to generate code for another instruction set (say x86)? Select all correct answers....
Consider the following BNF grammar: S ::= A x | B y A ::= B y | C w B ::= x | B w C ::= y Which of the following regular expressions describes the same set of strings as the grammar? 1. xwxy + xww∗y + ywx 2. xwx + xww∗y + yw 3. xw∗y + xwxyx + ywx 4. xwy + xw∗xyx + ywx 5. xw∗y + xw∗yx + ywx 6. none of the above 7. all...
1. Find the solution to the IVP : yy - x = 1, y (0) = 2 2. Find the general solution to the exact DE: e* dx – ydy = 0 3. Use ji = cos y to find an EXPLICIT solution to: (tan y)dx + xdy = 0
Solve the following:
1. x*y'-2*y-2*x^2*y 2. y xty/(x-5) 3. y'y/x, y(1)-2 4. yy+2*exp(2*x), y(0)=3 5. (1+x)*y+ysin(x), y(-pi/2)=0
1. x*y'-2*y-2*x^2*y 2. y xty/(x-5) 3. y'y/x, y(1)-2 4. yy+2*exp(2*x), y(0)=3 5. (1+x)*y+ysin(x), y(-pi/2)=0
Let A be the set of all bit strings of length 10. 1. How many bit strings of length 10 are there? How many bit strings of length 10 begin with 1101? How many bit strings of length 10 have exactly six 0's? How many bit strings of length 10 have equal numbers of O's and 1's? How many bit strings of length 10 have more O's than 1's? a. b. c. d. e.
How many strings of 10 decimal digits are there that contain the following combinations of numbers? Show your work. You may leave your answer in terms of an expression involving factorials/exponents. One 0, four 2’s, and five 8’s Exactly one 1, two 3’s, and one 7 (the other six digits can be anything
a) How many different strings can be made from the word PEPPERCORN when (SHOW WORK & Explaination) i) all the letters are used? ii) at least 6 of the letters are used? b) How many different strings can be made from the letters in AARDVARK, using all of the letters, if all three As must be consecutive? (SHOW WORK & Explaination) c) How many permuations of the 26 letters of the English alphabet do not contain any of the strings...