Question

Hello, I need help solving these two computer science questions.

3. Give a CFG for each of the following: (a) The language {0416 with a +b}. (b) All binary palindromes with exactly three 1s

0 0
Add a comment Improve this question Transcribed image text
Answer #1

3)

a)

GRAMMAR

S -> 0S1 | A | B
A -> 0A | 0
B -> 1B | 1

EXPLANATION

A is for 0+
B is for 1+
S is for equal number of 0's and 1's and to have extra 1's or extra 0s

b)

GRAMMAR

S -> 0S0 | 1A1
A -> 0A0 | 1B1
B -> 0B0 | 1C1
C -> 0C0 | epsilon

EXPLANATION

S is having 0 1's
A is having 1 1's
B is having 2 1's
C is having 3 1's

-- One question at a time please - Policy of Chegg

Add a comment
Know the answer?
Add Answer to:
Hello, I need help solving these two computer science questions. 3. Give a CFG for each...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hello, I need help solving this computer science problem. 1) Use the Pumping Lemma to show...

    Hello, I need help solving this computer science problem. 1) Use the Pumping Lemma to show that the set of all binary strings of length a power of 2 is not regular.

  • home / study / engineering / computer science / computer science questions and answers / l(a)...

    home / study / engineering / computer science / computer science questions and answers / l(a) be the language generated by g(a) - (n, 2, s, p) where 2 - [a, b), n= {s,x) and s->axb ... Your question has been answered Let us know if you got a helpful answer. Rate this answer Question: L(a) be the language generated by g(a) - (n, 2, s, p) where 2 - [a, b), n= {s,x) and s->axb ..... l(a) be the...

  • I need any IT expert - Computer Science - to help me solve these questions !!...

    I need any IT expert - Computer Science - to help me solve these questions !! Please do not copy from a book or from the same site or from other students' answers. The work should be your own answers. Please do not answer the handwriting and be a computer writing NO NO handwriting answers. Please do not copy from a book or from the same site or from other students' answers. The work should be your own answers. TO...

  • Hello, I need help solving this linear algebra problem. 1. Let L be the set of...

    Hello, I need help solving this linear algebra problem. 1. Let L be the set of all linear transforms from R3 to R2. (a) Verify that L is a vector space. (b) Determine the dimension of L and give a basis for L.

  • Computer science encryption please refer to the chart to help For the remaining questions, consider a...

    Computer science encryption please refer to the chart to help For the remaining questions, consider a 4-bit block cipher, described in hexadecimal by the following table: Plaintext Ciphertext Plaintext Ciphertext 4 You can think of this as a simple substitution cipher for hexadecimal digits. The table itself serves as the "key" s (6 pts) For this question, you will perform encryption and 5. decryption using the same cipher described above, but in CBC mode. Recall that you can convert hexadecimal...

  • Give a CFG that generates the language L(a*b*c*) \ { anbncn | n is a non-negative integer }. This...

    Give a CFG that generates the language L(a*b*c*) \ { anbncn | n is a non-negative integer }. This question is quite challenging; you will first need to devise a good strategy for how the CFG should work and then create the CFG to implement the strategy. You might want to do the other questions first. I'm so stuck on this question, can someone pls help me? The following questions ask you to write CFGs. An example illustrates the encoding...

  • Hello, i've tried to solve these questions myself. I would greatly appreciate any help with solving...

    Hello, i've tried to solve these questions myself. I would greatly appreciate any help with solving these two questions. 1) Balance the following redox reaction in basic solution. balance anyt" with OH Zn(s)+NO3- (aq) Zn2+(aq) +-NH3(aq) +5 -2 Zno znot the 30H + 3H² + NO3 cae NHacaq) + 2) A 1.67-g sample of solid silver reacted in excess chlorine gas to give a 2.21-g sample of pure solid AgCl. The heat given off in this reaction was 1.96 kJ...

  • The following are three questions on a practice examination for Computer Science 102. I need help...

    The following are three questions on a practice examination for Computer Science 102. I need help not only getting the answer but i need careful explanations and work shown for each of the three problems because some of these are "trick" questions: SHOW YOUR WORK AND LOGIC ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1 point What is printed to the screen with the code below? int main double a -5/2; cout << a; Type your answer... 23 1 point Given the following code...

  • Q: Help in understanding and solving this example from Data Structure & Algorithms (Computer Science) with...

    Q: Help in understanding and solving this example from Data Structure & Algorithms (Computer Science) with the steps of the solution to better understand, thanks. **Using R studio language, thanks. R Lab: You need to use R commands and using R markdown to generate a report that interacted with statistics R. A sample program is provided. x =0:20 theta<-3 pdff<- (1/theta)*exp(-x/theta) cdff<- 1-exp(-x/theta) plot(x, pdff, type ='l') Instructions: 1. Use R command to generate a sample of random numbers from...

  • Hello. Need help with these questions. Thank you 3. What is the approximate value (in Hz)...

    Hello. Need help with these questions. Thank you 3. What is the approximate value (in Hz) of a 3 bond coupling? Give a range. 4. What is the approximate value in Hz) of a 1 bond coupling? Give a range.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT