Question

In: Computer Science

Draw PDA transition diagram for the following language: The set of strings over the alphabet {x,...

Draw PDA transition diagram for the following language:

The set of strings over the alphabet {x, y} where 2 * (# of x's) = 3 * (#y's)

That is, if we let nx be the number of x's and ny be the number of y's, then the strings in these language are those where 2nx = 3ny

Try to find a PDA that is as simple and elegant as possible (do not convert from CFG).

------------------------------------------------------------------------------------------------------------------

USE Notation between transition:

for example x, a -> ε means read x, pop a and push ε

Solutions

Expert Solution

Given:

strings that can be generated by using this language must satisfy 2nx = 3ny

If nx = 3 and ny = 2 , 2* 3 = 3* 2, 6 = 6.

So the string For nx = 3 and ny = 2 the possibilities may be xxxyy, yyxxx, xyyxx, xxyyx, yxxxy, yxyxx, yxxyx, xyxyx, xyxxy, xxyxy.

Step 1:

If the y is first in string, push yy because nx is greater than ny .

if the x is first in string, push only x.

Step 2:

If the top of the stack is x and x is called, push xx. So, it cancels one x and adds one x to the stack.

If the top of the stack is y and y is called, push yy. So, it cancels one y and adds one y to the stack.

Step 3:

Suppose, if the top of the stack is x and y is called, pop x. (It gets cancels on each other)

Similarly if the top of the stack is y and x is called, pop y. (It gets cancels on each other)

step 4:

when string is finished and is called, Now the top of the stack must be Z0. The final state q1 is reached.


Related Solutions

Problem 4 (Sets defined inductively) [30 marks] Consider the set S of strings over the alphabet...
Problem 4 (Sets defined inductively) [30 marks] Consider the set S of strings over the alphabet {a, b} defined inductively as follows: • Base case: the empty word λ and the word a belong to S • Inductive rule: if ω is a string of S then both ω b and ω b a belong to S as well. 1. Prove that if a string ω belongs to S, then ω does not have two or more consecutive a’s. 2....
Using the pigeonhole theorem prove that any set of 220 10-character strings over the alphabet {a,b,c,d}...
Using the pigeonhole theorem prove that any set of 220 10-character strings over the alphabet {a,b,c,d} contains a pair of anagrams.
For the following data set: a) draw a scatter diagram, b) develop the estimation equation that...
For the following data set: a) draw a scatter diagram, b) develop the estimation equation that best describes the data, c) predict Y for X = 10, 15, 20. X 13 ,16 ,14 ,11 ,17 ,9 ,13 ,17 ,18, 12 Y 6.2 ,8.6 ,7.2 ,4.5 ,9.0 ,3.5 ,6.5 ,9.3 ,9.5, 5.7 Using the data given below, a) draw the scatterplot, b) develop the estimation equation that best describes the data, c) predict Y for X = 5, 6, 7. X...
S is the language over S = {a, b, c, d, e} containing all strings that...
S is the language over S = {a, b, c, d, e} containing all strings that start with at least 2 a's, followed by any number of b's, followed by 5 c's, followed by an odd number of d's, followed by an even number of e's.  For example, S contains aaabbcccccdee, aaaacccccdddeeee, and so on.  Write S symbolically in the manner of section 6.1, problem # 12 a) - f).  Example 6.12 will also be helpful. bonus: How many strings in {000, 11}*...
Write a regular expression for the language of all strings over {a,b} in which every b...
Write a regular expression for the language of all strings over {a,b} in which every b is directly preceded by a, and may not be directly followed by more than two consecutive a symbols.
Let L be the set of all languages over alphabet {0}. Show that L is uncountable,...
Let L be the set of all languages over alphabet {0}. Show that L is uncountable, using a proof by diagonalization.
Draw bifurication diagram of: (x^2-a)(x^2-4)
Draw bifurication diagram of: (x^2-a)(x^2-4)
A data set is given a) (a) Draw a scatter diagram. Comment on the type of...
A data set is given a) (a) Draw a scatter diagram. Comment on the type of relation that appears to exist between x and y. ​(b) Given that x overbarxequals=3.83333.8333​, s Subscript xsxequals=2.40142.4014​, y overbaryequals=3.98333.9833​, s Subscript ysyequals=1.74521.7452​, and requals=negative 0.9457−0.9457​, determine the​ least-squares regression line. ​(c) Graph the​ least-squares regression line on the scatter diagram drawn in part​ (a). x 0 2 4 5 6 6 y 6.0 5.8 4.7 3.0 2.1 2.3
Design an FA (Finite automaton) and RE to accept the set of all strings over the...
Design an FA (Finite automaton) and RE to accept the set of all strings over the alphabet {0,1} which contains even number of 0's and odd number of 1's.
For the accompanying data​ set, (a) draw a scatter diagram of the​ data, (b) by​ hand,...
For the accompanying data​ set, (a) draw a scatter diagram of the​ data, (b) by​ hand, compute the correlation​ coefficient, and​ (c) determine whether there is a linear relation between x and y. n 3 0.997 4 0.950 5 0.878 6 0.811 7 0.754 8 0.707 9 0.666 10 0.632 11 0.602 12 0.576 13 0.553 14 0.532 15 0.514 16 0.497 17 0.482 18 0.468 19 0.456 20 0.444 21 0.433 22 0.423 23 0.413 24 0.404 25 0.396...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT